diff --git a/backend/lib/Model/Proxies/VolkszaehlerModelChannelProxy.php b/backend/lib/Model/Proxies/VolkszaehlerModelChannelProxy.php index b778130..c35fc9b 100644 --- a/backend/lib/Model/Proxies/VolkszaehlerModelChannelProxy.php +++ b/backend/lib/Model/Proxies/VolkszaehlerModelChannelProxy.php @@ -22,8 +22,7 @@ class VolkszaehlerModelChannelProxy extends \Volkszaehler\Model\Channel implemen if ($this->_entityPersister->load($this->_identifier, $this) === null) { throw new \Doctrine\ORM\EntityNotFoundException(); } - unset($this->_entityPersister); - unset($this->_identifier); + unset($this->_entityPersister, $this->_identifier); } } @@ -34,10 +33,10 @@ class VolkszaehlerModelChannelProxy extends \Volkszaehler\Model\Channel implemen return parent::addData($data); } - public function getInterpreter(\Doctrine\ORM\EntityManager $em) + public function getInterpreter(\Doctrine\ORM\EntityManager $em, $from, $to) { $this->_load(); - return parent::getInterpreter($em); + return parent::getInterpreter($em, $from, $to); } public function getName() @@ -64,18 +63,6 @@ class VolkszaehlerModelChannelProxy extends \Volkszaehler\Model\Channel implemen return parent::setDescription($description); } - public function getUnit() - { - $this->_load(); - return parent::getUnit(); - } - - public function getIndicator() - { - $this->_load(); - return parent::getIndicator(); - } - public function getResolution() { $this->_load(); @@ -100,6 +87,48 @@ class VolkszaehlerModelChannelProxy extends \Volkszaehler\Model\Channel implemen return parent::setCost($cost); } + public function getType() + { + $this->_load(); + return parent::getType(); + } + + public function getUnit() + { + $this->_load(); + return parent::getUnit(); + } + + public function getIndicator() + { + $this->_load(); + return parent::getIndicator(); + } + + public function validateToken($token) + { + $this->_load(); + return parent::validateToken($token); + } + + public function getToken() + { + $this->_load(); + return parent::getToken(); + } + + public function getProperty($name) + { + $this->_load(); + return parent::getProperty($name); + } + + public function setProperty($name) + { + $this->_load(); + return parent::setProperty($name); + } + public function getId() { $this->_load(); @@ -115,9 +144,6 @@ class VolkszaehlerModelChannelProxy extends \Volkszaehler\Model\Channel implemen public function __sleep() { - if (!$this->__isInitialized__) { - throw new \RuntimeException("Not fully loaded proxy can not be serialized."); - } - return array('name', 'description', 'indicator', 'data', 'resolution', 'cost', 'groups', 'id', 'uuid'); + return array('__isInitialized__', 'id', 'uuid', 'tokens', 'properties', 'data', 'groups'); } } \ No newline at end of file diff --git a/backend/lib/Model/Proxies/VolkszaehlerModelDataProxy.php b/backend/lib/Model/Proxies/VolkszaehlerModelDataProxy.php index 7a193b5..db04e1e 100644 --- a/backend/lib/Model/Proxies/VolkszaehlerModelDataProxy.php +++ b/backend/lib/Model/Proxies/VolkszaehlerModelDataProxy.php @@ -22,12 +22,17 @@ class VolkszaehlerModelDataProxy extends \Volkszaehler\Model\Data implements \Do if ($this->_entityPersister->load($this->_identifier, $this) === null) { throw new \Doctrine\ORM\EntityNotFoundException(); } - unset($this->_entityPersister); - unset($this->_identifier); + unset($this->_entityPersister, $this->_identifier); } } + public function toArray() + { + $this->_load(); + return parent::toArray(); + } + public function getValue() { $this->_load(); @@ -49,9 +54,6 @@ class VolkszaehlerModelDataProxy extends \Volkszaehler\Model\Data implements \Do public function __sleep() { - if (!$this->__isInitialized__) { - throw new \RuntimeException("Not fully loaded proxy can not be serialized."); - } - return array('timestamp', 'value', 'channel'); + return array('__isInitialized__', 'id', 'timestamp', 'value', 'channel'); } } \ No newline at end of file diff --git a/backend/lib/Model/Proxies/VolkszaehlerModelEntityProxy.php b/backend/lib/Model/Proxies/VolkszaehlerModelEntityProxy.php index 4482eea..ce51a1d 100644 --- a/backend/lib/Model/Proxies/VolkszaehlerModelEntityProxy.php +++ b/backend/lib/Model/Proxies/VolkszaehlerModelEntityProxy.php @@ -22,12 +22,35 @@ class VolkszaehlerModelEntityProxy extends \Volkszaehler\Model\Entity implements if ($this->_entityPersister->load($this->_identifier, $this) === null) { throw new \Doctrine\ORM\EntityNotFoundException(); } - unset($this->_entityPersister); - unset($this->_identifier); + unset($this->_entityPersister, $this->_identifier); } } + public function validateToken($token) + { + $this->_load(); + return parent::validateToken($token); + } + + public function getToken() + { + $this->_load(); + return parent::getToken(); + } + + public function getProperty($name) + { + $this->_load(); + return parent::getProperty($name); + } + + public function setProperty($name) + { + $this->_load(); + return parent::setProperty($name); + } + public function getId() { $this->_load(); @@ -43,9 +66,6 @@ class VolkszaehlerModelEntityProxy extends \Volkszaehler\Model\Entity implements public function __sleep() { - if (!$this->__isInitialized__) { - throw new \RuntimeException("Not fully loaded proxy can not be serialized."); - } - return array(); + return array('__isInitialized__', 'id', 'uuid', 'tokens', 'properties'); } } \ No newline at end of file diff --git a/backend/lib/Model/Proxies/VolkszaehlerModelGroupProxy.php b/backend/lib/Model/Proxies/VolkszaehlerModelGroupProxy.php index 10ec167..dea59e7 100644 --- a/backend/lib/Model/Proxies/VolkszaehlerModelGroupProxy.php +++ b/backend/lib/Model/Proxies/VolkszaehlerModelGroupProxy.php @@ -22,8 +22,7 @@ class VolkszaehlerModelGroupProxy extends \Volkszaehler\Model\Group implements \ if ($this->_entityPersister->load($this->_identifier, $this) === null) { throw new \Doctrine\ORM\EntityNotFoundException(); } - unset($this->_entityPersister); - unset($this->_identifier); + unset($this->_entityPersister, $this->_identifier); } } @@ -34,12 +33,24 @@ class VolkszaehlerModelGroupProxy extends \Volkszaehler\Model\Group implements \ return parent::addGroup($child); } + public function removeGroup(\Volkszaehler\Model\Group $child) + { + $this->_load(); + return parent::removeGroup($child); + } + public function addChannel(\Volkszaehler\Model\Channel $child) { $this->_load(); return parent::addChannel($child); } + public function removeChannel(\Volkszaehler\Model\Channel $child) + { + $this->_load(); + return parent::removeChannel($child); + } + public function getName() { $this->_load(); @@ -82,6 +93,36 @@ class VolkszaehlerModelGroupProxy extends \Volkszaehler\Model\Group implements \ return parent::getChannels(); } + public function getInterpreter(\Doctrine\ORM\EntityManager $em) + { + $this->_load(); + return parent::getInterpreter($em); + } + + public function validateToken($token) + { + $this->_load(); + return parent::validateToken($token); + } + + public function getToken() + { + $this->_load(); + return parent::getToken(); + } + + public function getProperty($name) + { + $this->_load(); + return parent::getProperty($name); + } + + public function setProperty($name) + { + $this->_load(); + return parent::setProperty($name); + } + public function getId() { $this->_load(); @@ -97,9 +138,6 @@ class VolkszaehlerModelGroupProxy extends \Volkszaehler\Model\Group implements \ public function __sleep() { - if (!$this->__isInitialized__) { - throw new \RuntimeException("Not fully loaded proxy can not be serialized."); - } - return array('name', 'description', 'channels', 'children', 'parents', 'id', 'uuid'); + return array('__isInitialized__', 'id', 'uuid', 'tokens', 'properties', 'channels', 'children', 'parents'); } } \ No newline at end of file diff --git a/backend/lib/Model/Proxies/VolkszaehlerModelPropertyProxy.php b/backend/lib/Model/Proxies/VolkszaehlerModelPropertyProxy.php new file mode 100644 index 0000000..68cd655 --- /dev/null +++ b/backend/lib/Model/Proxies/VolkszaehlerModelPropertyProxy.php @@ -0,0 +1,35 @@ +_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 __sleep() + { + return array('__isInitialized__', 'id', 'name', 'value', 'entity'); + } +} \ No newline at end of file diff --git a/backend/lib/Model/Proxies/VolkszaehlerModelTokenProxy.php b/backend/lib/Model/Proxies/VolkszaehlerModelTokenProxy.php new file mode 100644 index 0000000..aca599b --- /dev/null +++ b/backend/lib/Model/Proxies/VolkszaehlerModelTokenProxy.php @@ -0,0 +1,47 @@ +_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 __toString() + { + $this->_load(); + return parent::__toString(); + } + + public function getToken() + { + $this->_load(); + return parent::getToken(); + } + + + public function __sleep() + { + return array('__isInitialized__', 'id', 'token', 'valid', 'entity'); + } +} \ No newline at end of file