_entityPersister = $entityPersister; $this->_identifier = $identifier; } private function _load() { if (!$this->__isInitialized__ && $this->_entityPersister) { $this->__isInitialized__ = true; if ($this->_entityPersister->load($this->_identifier, $this) === null) { throw new \Doctrine\ORM\EntityNotFoundException(); } unset($this->_entityPersister, $this->_identifier); } } public function getId() { $this->_load(); return parent::getId(); } public function getSlug() { $this->_load(); return parent::getSlug(); } public function setTitle($title) { $this->_load(); return parent::setTitle($title); } public function getTitle() { $this->_load(); return parent::getTitle(); } public function setParent(\Tree\Fixture\BehavioralCategory $parent) { $this->_load(); return parent::setParent($parent); } public function getParent() { $this->_load(); return parent::getParent(); } public function __sleep() { return array('__isInitialized__', 'id', 'title', 'lft', 'rgt', 'parent', 'children', 'slug'); } public function __clone() { if (!$this->__isInitialized__ && $this->_entityPersister) { $this->__isInitialized__ = true; $class = $this->_entityPersister->getClassMetadata(); $original = $this->_entityPersister->load($this->_identifier); if ($original === null) { throw new \Doctrine\ORM\EntityNotFoundException(); } foreach ($class->reflFields AS $field => $reflProperty) { $reflProperty->setValue($this, $reflProperty->getValue($original)); } unset($this->_entityPersister, $this->_identifier); } } }