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; } public function hasAccess(\User_Adapter $user) { foreach ($this->getOwners() as $owner) { if ($owner->getUser()->get_id() == $user->get_id()) return true; } return false; } /** * * @param \User_Adapter $user * @return \Entities\UsrListOwner */ public function getOwner(\User_Adapter $user) { foreach ($this->getOwners() as $owner) { if ($owner->getUser()->get_id() == $user->get_id()) return $owner; } throw new \Exception('This user is not an owner of the list'); } /** * Add users * * @param Entities\UsrListContent $users */ public function addUsrListEntry(\Entities\UsrListEntry $users) { $this->users[] = $users; } /** * Get users * * @return Doctrine\Common\Collections\Collection */ public function getUsers() { return $this->users; } }