Commit 868e0bca authored by zYne's avatar zYne

added Doctrine_Access::__isset() and Doctrine_Access::__unset() for complete...

added Doctrine_Access::__isset() and Doctrine_Access::__unset() for complete support of magic method invocations
parent 5f44b71a
...@@ -59,12 +59,28 @@ abstract class Doctrine_Access implements ArrayAccess { ...@@ -59,12 +59,28 @@ abstract class Doctrine_Access implements ArrayAccess {
public function __get($name) { public function __get($name) {
return $this->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 * @param mixed $offset
* @return boolean -- whether or not the data has a field $offset * @return boolean -- whether or not the data has a field $offset
*/ */
public function offsetExists($offset) { public function offsetExists($offset) {
return (bool) isset($this->data[$offset]); return $this->contains($offset);
} }
/** /**
* offsetGet -- an alias of get() * offsetGet -- an alias of get()
......
...@@ -751,12 +751,12 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite ...@@ -751,12 +751,12 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
} }
} }
/** /**
* __isset * contains
* *
* @param string $name * @param string $name
* @return boolean * @return boolean
*/ */
public function __isset($name) { public function contains($name) {
if(isset($this->data[$name])) if(isset($this->data[$name]))
return true; return true;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment