From f213a678bfcc0a54bc215d7ddbe6efab829b2cc7 Mon Sep 17 00:00:00 2001 From: Alec Robertson Date: Thu, 29 May 2025 11:17:54 -0400 Subject: [PATCH] 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. --- php/relate/class-relationship.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/php/relate/class-relationship.php b/php/relate/class-relationship.php index 8ae352110..072d7dd52 100644 --- a/php/relate/class-relationship.php +++ b/php/relate/class-relationship.php @@ -117,6 +117,19 @@ public function __get( $key ) { return $return; } + /** + * Check the existence of a relationship data value. + * + * @param string $key The key. + * + * @return bool + */ + public function __isset( $key ) { + $data_cache = $this->get_data(); + + return isset( $data_cache[ $key ] ); + } + /** * Set the save on shutdown flag. */