From 7fb481c1e523fb4865394ec9c0048a237b7577fe Mon Sep 17 00:00:00 2001 From: Romain Neutron Date: Mon, 2 Jan 2012 12:45:56 +0100 Subject: [PATCH] Usr List entities / proxies / repositories --- lib/Doctrine/Entities/UsrList.php | 168 ++++++++++++++++++ lib/Doctrine/Entities/UsrListContent.php | 142 +++++++++++++++ lib/Doctrine/Entities/UsrListOwner.php | 167 +++++++++++++++++ .../Proxies/EntitiesUsrListContentProxy.php | 121 +++++++++++++ .../Proxies/EntitiesUsrListOwnerProxy.php | 133 ++++++++++++++ lib/Doctrine/Proxies/EntitiesUsrListProxy.php | 127 +++++++++++++ .../Repositories/UsrListContentRepository.php | 15 ++ .../Repositories/UsrListOwnerRepository.php | 15 ++ .../Repositories/UsrListRepository.php | 15 ++ 9 files changed, 903 insertions(+) create mode 100644 lib/Doctrine/Entities/UsrList.php create mode 100644 lib/Doctrine/Entities/UsrListContent.php create mode 100644 lib/Doctrine/Entities/UsrListOwner.php create mode 100644 lib/Doctrine/Proxies/EntitiesUsrListContentProxy.php create mode 100644 lib/Doctrine/Proxies/EntitiesUsrListOwnerProxy.php create mode 100644 lib/Doctrine/Proxies/EntitiesUsrListProxy.php create mode 100644 lib/Doctrine/Repositories/UsrListContentRepository.php create mode 100644 lib/Doctrine/Repositories/UsrListOwnerRepository.php create mode 100644 lib/Doctrine/Repositories/UsrListRepository.php diff --git a/lib/Doctrine/Entities/UsrList.php b/lib/Doctrine/Entities/UsrList.php new file mode 100644 index 0000000000..f654fdc2f4 --- /dev/null +++ b/lib/Doctrine/Entities/UsrList.php @@ -0,0 +1,168 @@ +owners = new \Doctrine\Common\Collections\ArrayCollection(); + $this->users = new \Doctrine\Common\Collections\ArrayCollection(); + } + + /** + * Get id + * + * @return integer + */ + public function getId() + { + return $this->id; + } + + /** + * Set name + * + * @param string $name + */ + public function setName($name) + { + $this->name = $name; + } + + /** + * Get name + * + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Set created + * + * @param datetime $created + */ + public function setCreated($created) + { + $this->created = $created; + } + + /** + * Get created + * + * @return datetime + */ + public function getCreated() + { + return $this->created; + } + + /** + * Set updated + * + * @param datetime $updated + */ + public function setUpdated($updated) + { + $this->updated = $updated; + } + + /** + * Get updated + * + * @return datetime + */ + public function getUpdated() + { + return $this->updated; + } + + /** + * Add owners + * + * @param Entities\UsrListOwner $owners + */ + public function addUsrListOwner(\Entities\UsrListOwner $owners) + { + $this->owners[] = $owners; + } + + /** + * Get owners + * + * @return Doctrine\Common\Collections\Collection + */ + public function getOwners() + { + return $this->owners; + } + + /** + * Add users + * + * @param Entities\UsrListContent $users + */ + public function addUsrListContent(\Entities\UsrListContent $users) + { + $this->users[] = $users; + } + + /** + * Get users + * + * @return Doctrine\Common\Collections\Collection + */ + public function getUsers() + { + return $this->users; + } + +} \ No newline at end of file diff --git a/lib/Doctrine/Entities/UsrListContent.php b/lib/Doctrine/Entities/UsrListContent.php new file mode 100644 index 0000000000..d072f8cd48 --- /dev/null +++ b/lib/Doctrine/Entities/UsrListContent.php @@ -0,0 +1,142 @@ +id; + } + + /** + * Set usr_id + * + * @param integer $usrId + */ + public function setUsrId($usrId) + { + $this->usr_id = $usrId; + } + + /** + * Get usr_id + * + * @return integer + */ + public function getUsrId() + { + return $this->usr_id; + } + + /** + * Set created + * + * @param datetime $created + */ + public function setCreated($created) + { + $this->created = $created; + } + + /** + * Get created + * + * @return datetime + */ + public function getCreated() + { + return $this->created; + } + + /** + * Set updated + * + * @param datetime $updated + */ + public function setUpdated($updated) + { + $this->updated = $updated; + } + + /** + * Get updated + * + * @return datetime + */ + public function getUpdated() + { + return $this->updated; + } + + /** + * Set list + * + * @param Entities\UsrList $list + */ + public function setList(\Entities\UsrList $list) + { + $this->list = $list; + } + + /** + * Get list + * + * @return Entities\UsrList + */ + public function getList() + { + return $this->list; + } + + public function getUser() + { + return \User_Adapter::getInstance($this->getUsrId(), \appbox::get_instance()); + } + +} \ No newline at end of file diff --git a/lib/Doctrine/Entities/UsrListOwner.php b/lib/Doctrine/Entities/UsrListOwner.php new file mode 100644 index 0000000000..de549a2d8a --- /dev/null +++ b/lib/Doctrine/Entities/UsrListOwner.php @@ -0,0 +1,167 @@ +id; + } + + /** + * Set usr_id + * + * @param integer $usrId + */ + public function setUsrId($usrId) + { + $this->usr_id = $usrId; + } + + /** + * Get usr_id + * + * @return integer + */ + public function getUsrId() + { + return $this->usr_id; + } + + /** + * Set role + * + * @param string $role + */ + public function setRole($role) + { + $this->role = $role; + } + + /** + * Get role + * + * @return string + */ + public function getRole() + { + return $this->role; + } + + /** + * Set created + * + * @param datetime $created + */ + public function setCreated($created) + { + $this->created = $created; + } + + /** + * Get created + * + * @return datetime + */ + public function getCreated() + { + return $this->created; + } + + /** + * Set updated + * + * @param datetime $updated + */ + public function setUpdated($updated) + { + $this->updated = $updated; + } + + /** + * Get updated + * + * @return datetime + */ + public function getUpdated() + { + return $this->updated; + } + + /** + * Set list + * + * @param Entities\UsrList $list + */ + public function setList(\Entities\UsrList $list) + { + $this->list = $list; + } + + /** + * Get list + * + * @return Entities\UsrList + */ + public function getList() + { + return $this->list; + } + + public function getUser() + { + return \User_Adapter::getInstance($this->getUsrId(), \appbox::get_instance()); + } + +} \ No newline at end of file diff --git a/lib/Doctrine/Proxies/EntitiesUsrListContentProxy.php b/lib/Doctrine/Proxies/EntitiesUsrListContentProxy.php new file mode 100644 index 0000000000..f2321acd2b --- /dev/null +++ b/lib/Doctrine/Proxies/EntitiesUsrListContentProxy.php @@ -0,0 +1,121 @@ +_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); + } + } + + + public function getId() + { + $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 setCreated($created) + { + $this->__load(); + return parent::setCreated($created); + } + + public function getCreated() + { + $this->__load(); + return parent::getCreated(); + } + + public function setUpdated($updated) + { + $this->__load(); + return parent::setUpdated($updated); + } + + public function getUpdated() + { + $this->__load(); + return parent::getUpdated(); + } + + public function setList(\Entities\UsrList $list) + { + $this->__load(); + return parent::setList($list); + } + + public function getList() + { + $this->__load(); + return parent::getList(); + } + + public function getUser() + { + $this->__load(); + return parent::getUser(); + } + + + public function __sleep() + { + return array('__isInitialized__', 'id', 'usr_id', 'created', 'updated', 'list'); + } + + 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); + } + + } +} \ No newline at end of file diff --git a/lib/Doctrine/Proxies/EntitiesUsrListOwnerProxy.php b/lib/Doctrine/Proxies/EntitiesUsrListOwnerProxy.php new file mode 100644 index 0000000000..7a4ca66326 --- /dev/null +++ b/lib/Doctrine/Proxies/EntitiesUsrListOwnerProxy.php @@ -0,0 +1,133 @@ +_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); + } + } + + + public function getId() + { + $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 setRole($role) + { + $this->__load(); + return parent::setRole($role); + } + + public function getRole() + { + $this->__load(); + return parent::getRole(); + } + + public function setCreated($created) + { + $this->__load(); + return parent::setCreated($created); + } + + public function getCreated() + { + $this->__load(); + return parent::getCreated(); + } + + public function setUpdated($updated) + { + $this->__load(); + return parent::setUpdated($updated); + } + + public function getUpdated() + { + $this->__load(); + return parent::getUpdated(); + } + + public function setList(\Entities\UsrList $list) + { + $this->__load(); + return parent::setList($list); + } + + public function getList() + { + $this->__load(); + return parent::getList(); + } + + public function getUser() + { + $this->__load(); + return parent::getUser(); + } + + + public function __sleep() + { + return array('__isInitialized__', 'id', 'usr_id', 'role', 'created', 'updated', 'list'); + } + + 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); + } + + } +} \ No newline at end of file diff --git a/lib/Doctrine/Proxies/EntitiesUsrListProxy.php b/lib/Doctrine/Proxies/EntitiesUsrListProxy.php new file mode 100644 index 0000000000..afb41a302f --- /dev/null +++ b/lib/Doctrine/Proxies/EntitiesUsrListProxy.php @@ -0,0 +1,127 @@ +_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); + } + } + + + public function getId() + { + $this->__load(); + return parent::getId(); + } + + public function setName($name) + { + $this->__load(); + return parent::setName($name); + } + + public function getName() + { + $this->__load(); + return parent::getName(); + } + + public function setCreated($created) + { + $this->__load(); + return parent::setCreated($created); + } + + public function getCreated() + { + $this->__load(); + return parent::getCreated(); + } + + public function setUpdated($updated) + { + $this->__load(); + return parent::setUpdated($updated); + } + + public function getUpdated() + { + $this->__load(); + return parent::getUpdated(); + } + + public function addUsrListOwner(\Entities\UsrListOwner $owners) + { + $this->__load(); + return parent::addUsrListOwner($owners); + } + + public function getOwners() + { + $this->__load(); + return parent::getOwners(); + } + + public function addUsrListContent(\Entities\UsrListContent $users) + { + $this->__load(); + return parent::addUsrListContent($users); + } + + public function getUsers() + { + $this->__load(); + return parent::getUsers(); + } + + + public function __sleep() + { + return array('__isInitialized__', 'id', 'name', 'created', 'updated', 'owners', 'users'); + } + + 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); + } + + } +} \ No newline at end of file diff --git a/lib/Doctrine/Repositories/UsrListContentRepository.php b/lib/Doctrine/Repositories/UsrListContentRepository.php new file mode 100644 index 0000000000..c3bcdffe6b --- /dev/null +++ b/lib/Doctrine/Repositories/UsrListContentRepository.php @@ -0,0 +1,15 @@ +