1
0
mirror of synced 2024-12-13 06:46:03 +03:00

added Doctrine_Access::__isset() and Doctrine_Access::__unset() for complete support of magic method invocations

This commit is contained in:
zYne 2006-09-13 09:40:22 +00:00
parent 5f44b71af6
commit 868e0bcae7
2 changed files with 19 additions and 3 deletions

View File

@ -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()

View File

@ -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;