From 868e0bcae716a09f3a817d5ffa156f8e5a416df5 Mon Sep 17 00:00:00 2001 From: zYne Date: Wed, 13 Sep 2006 09:40:22 +0000 Subject: [PATCH] added Doctrine_Access::__isset() and Doctrine_Access::__unset() for complete support of magic method invocations --- Doctrine/Access.php | 18 +++++++++++++++++- Doctrine/Record.php | 4 ++-- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/Doctrine/Access.php b/Doctrine/Access.php index 40adbc853..29968e5f8 100644 --- a/Doctrine/Access.php +++ b/Doctrine/Access.php @@ -59,12 +59,28 @@ abstract class Doctrine_Access implements ArrayAccess { public function __get($name) { return $this->get($name); } + /** + * __isset() + * + * @param string $name + */ + public function __isset($name) { + return $this->contains($name); + } + /** + * __unset() + * + * @param string $name + */ + public function __unset($name) { + return $this->remove($name); + } /** * @param mixed $offset * @return boolean -- whether or not the data has a field $offset */ public function offsetExists($offset) { - return (bool) isset($this->data[$offset]); + return $this->contains($offset); } /** * offsetGet -- an alias of get() diff --git a/Doctrine/Record.php b/Doctrine/Record.php index 807bc8e79..c0943398f 100644 --- a/Doctrine/Record.php +++ b/Doctrine/Record.php @@ -751,12 +751,12 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite } } /** - * __isset + * contains * * @param string $name * @return boolean */ - public function __isset($name) { + public function contains($name) { if(isset($this->data[$name])) return true;