$owner * @param $assoc * @param $refProp */ public function __construct($owner, Doctrine_ORM_Mapping_AssociationMapping $assoc, ReflectionProperty $refProp) { $this->_owner = $owner; $this->_assoc = $assoc; $this->_refProp = $refProp; } private function _load() { $realInstance = $tis->_assoc->lazyLoadFor($this->_owner); $this->_refProp->setValue($this->_owner, $realInstance); return $realInstance; } /** All the "magic" interceptors */ public function __call($method, $args) { $realInstance = $this->_load(); return call_user_func_array(array($realInstance, $method), $args); } public function __get($prop) { $realInstance = $this->_load(); return $realInstance->$prop; } public function __set($prop, $value) { $realInstance = $this->_load(); $realInstance->$prop = $value; } public function __isset($prop) { $realInstance = $this->_load(); return isset($realInstance->$prop); } public function __unset($prop) { $realInstance = $this->_load(); unset($realInstance->$prop); } }