_entityPersister = $entityPersister; $this->_identifier = $identifier; } /** @private */ public function __load() { if (!$this->__isInitialized__ && $this->_entityPersister) { $this->__isInitialized__ = true; if (method_exists($this, "__wakeup")) { // call this after __isInitialized__to avoid infinite recursion // but before loading to emulate what ClassMetadata::newInstance() // provides. $this->__wakeup(); } if ($this->_entityPersister->load($this->_identifier, $this) === null) { throw new \Doctrine\ORM\EntityNotFoundException(); } unset($this->_entityPersister, $this->_identifier); } } /** @private */ public function __isInitialized() { return $this->__isInitialized__; } public function getId() { if ($this->__isInitialized__ === false) { return (int) $this->_identifier["id"]; } $this->__load(); return parent::getId(); } public function setUsrId($usrId) { $this->__load(); return parent::setUsrId($usrId); } public function getUsrId() { $this->__load(); return parent::getUsrId(); } public function setDeadline($deadline) { $this->__load(); return parent::setDeadline($deadline); } public function getDeadline() { $this->__load(); return parent::getDeadline(); } public function setCreatedOn($createdOn) { $this->__load(); return parent::setCreatedOn($createdOn); } public function getCreatedOn() { $this->__load(); return parent::getCreatedOn(); } public function addElement(\Alchemy\Phrasea\Model\Entities\OrderElement $elements) { $this->__load(); return parent::addElement($elements); } public function removeElement(\Alchemy\Phrasea\Model\Entities\OrderElement $elements) { $this->__load(); return parent::removeElement($elements); } public function getElements() { $this->__load(); return parent::getElements(); } public function getUser(\Alchemy\Phrasea\Application $app) { $this->__load(); return parent::getUser($app); } public function setTodo($todo) { $this->__load(); return parent::setTodo($todo); } public function getTodo() { $this->__load(); return parent::getTodo(); } public function getTotal() { $this->__load(); return parent::getTotal(); } public function setOrderUsage($orderUsage) { $this->__load(); return parent::setOrderUsage($orderUsage); } public function getOrderUsage() { $this->__load(); return parent::getOrderUsage(); } public function setBasket(\Alchemy\Phrasea\Model\Entities\Basket $basket = NULL) { $this->__load(); return parent::setBasket($basket); } public function getBasket() { $this->__load(); return parent::getBasket(); } public function __sleep() { return array('__isInitialized__', 'id', 'usrId', 'orderUsage', 'todo', 'deadline', 'createdOn', 'elements', 'basket'); } 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); } } }