Skip to content

Commit f213a67

Browse files
committed
Add __isset() method to Relationship class
Without this, calling `isset()` on an overloaded property accessed via the magic `__get()` method, like `public_id` returns `false`, even if it is set.
1 parent 433e690 commit f213a67

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

php/relate/class-relationship.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,19 @@ public function __get( $key ) {
117117
return $return;
118118
}
119119

120+
/**
121+
* Check the existence of a relationship data value.
122+
*
123+
* @param string $key The key.
124+
*
125+
* @return bool
126+
*/
127+
public function __isset( $key ) {
128+
$data_cache = $this->get_data();
129+
130+
return isset( $data_cache[ $key ] );
131+
}
132+
120133
/**
121134
* Set the save on shutdown flag.
122135
*/

0 commit comments

Comments
 (0)