Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Task.php
- /**
- * @ORM\ManyToMany(targetEntity="Site", mappedBy="tasks", cascade={"all"})
- */
- private $sites;
- /**
- * @ORM\ManyToMany(targetEntity="User", mappedBy="tasks", cascade={"all"})
- */
- private $users;
- public function __construct() {
- $this->users = new \Doctrine\Common\Collections\ArrayCollection();
- $this->sites = new \Doctrine\Common\Collections\ArrayCollection();
- }
- /**
- * Add sites
- *
- * @return Ev\MyEvBundle\Entity\Site $sites
- */
- public function addSite(\Ev\MyEvBundle\Entity\Site $sites)
- {
- $site->addTask($this);
- $this->sites[] = $sites;
- }
- /**
- * Get sites
- *
- * @return Doctrine\Common\Collections\Collection
- */
- public function getSites()
- {
- return $this->sites;
- }
- /**
- * Set sites
- *
- * @return Doctrine\Common\Collections\Collection
- */
- public function setSites(Doctrine\Common\Collections\Collection $sites)
- {
- $this->sites = $sites;
- }
- /**
- * Add users
- *
- * @param Ev\MyEvBundle\Entity\User $users
- */
- public function addUser(\Ev\MyEvBundle\Entity\User $users)
- {
- $this->users[] = $users;
- }
- /**
- * Get users
- *
- * @return Doctrine\Common\Collections\Collection
- */
- public function getUsers()
- {
- return $this->users;
- }
- /**
- * Set users
- *
- * @return Doctrine\Common\Collections\Collection
- */
- public function setUsers(Doctrine\Common\Collections\Collection $users)
- {
- $this->users = $users;
- }
- _______________________________________________
- Site.php
- /**
- * @ORM\ManyToMany(targetEntity="Task", inversedBy="sites")
- * @ORM\OrderBy({"name" = "ASC"})
- * @ORM\JoinTable(name="site_tasks",
- * joinColumns={@ORM\JoinColumn(name="site_id", referencedColumnName="id", nullable=true)},
- * inverseJoinColumns={@ORM\JoinColumn(name="task_id", referencedColumnName="id", nullable=true)}
- * )
- */
- private $tasks;
- public function __construct(){
- $this->tags = new \Doctrine\Common\Collections\ArrayCollection();
- $this->tasks = new \Doctrine\Common\Collections\ArrayCollection();
- }
- /**
- * Add tasks
- *
- * @param Ev\MyEvBundle\Entity\Task $tasks
- */
- public function addTask(\Ev\MyEvBundle\Entity\Task $tasks)
- {
- $this->tasks[] = $tasks;
- }
- /**
- * Get tasks
- *
- * @return Doctrine\Common\Collections\Collection
- */
- public function getTasks()
- {
- return $this->tasks;
- }
- /**
- * Set Tasks
- *
- * @param Doctrine\Common\Collections\Collection $tasks
- */
- public function setTasks(\Ev\MyEvBundle\Entity\User $tasks)
- {
- $this->tasks = $tasks;
- }
Add Comment
Please, Sign In to add comment