Guest User

Untitled

a guest
Jul 21st, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.88 KB | None | 0 0
  1. Task.php
  2.  
  3. /**
  4. * @ORM\ManyToMany(targetEntity="Site", mappedBy="tasks", cascade={"all"})
  5. */
  6. private $sites;
  7.  
  8. /**
  9. * @ORM\ManyToMany(targetEntity="User", mappedBy="tasks", cascade={"all"})
  10. */
  11. private $users;
  12.  
  13. public function __construct() {
  14. $this->users = new \Doctrine\Common\Collections\ArrayCollection();
  15. $this->sites = new \Doctrine\Common\Collections\ArrayCollection();
  16. }
  17.  
  18. /**
  19. * Add sites
  20. *
  21. * @return Ev\MyEvBundle\Entity\Site $sites
  22. */
  23. public function addSite(\Ev\MyEvBundle\Entity\Site $sites)
  24. {
  25. $site->addTask($this);
  26. $this->sites[] = $sites;
  27. }
  28.  
  29. /**
  30. * Get sites
  31. *
  32. * @return Doctrine\Common\Collections\Collection
  33. */
  34. public function getSites()
  35. {
  36. return $this->sites;
  37. }
  38.  
  39. /**
  40. * Set sites
  41. *
  42. * @return Doctrine\Common\Collections\Collection
  43. */
  44. public function setSites(Doctrine\Common\Collections\Collection $sites)
  45. {
  46. $this->sites = $sites;
  47. }
  48.  
  49. /**
  50. * Add users
  51. *
  52. * @param Ev\MyEvBundle\Entity\User $users
  53. */
  54. public function addUser(\Ev\MyEvBundle\Entity\User $users)
  55. {
  56. $this->users[] = $users;
  57. }
  58.  
  59. /**
  60. * Get users
  61. *
  62. * @return Doctrine\Common\Collections\Collection
  63. */
  64. public function getUsers()
  65. {
  66. return $this->users;
  67. }
  68.  
  69. /**
  70. * Set users
  71. *
  72. * @return Doctrine\Common\Collections\Collection
  73. */
  74. public function setUsers(Doctrine\Common\Collections\Collection $users)
  75. {
  76. $this->users = $users;
  77. }
  78.  
  79.  
  80.  
  81.  
  82. _______________________________________________
  83.  
  84. Site.php
  85.  
  86.  
  87. /**
  88. * @ORM\ManyToMany(targetEntity="Task", inversedBy="sites")
  89. * @ORM\OrderBy({"name" = "ASC"})
  90. * @ORM\JoinTable(name="site_tasks",
  91. * joinColumns={@ORM\JoinColumn(name="site_id", referencedColumnName="id", nullable=true)},
  92. * inverseJoinColumns={@ORM\JoinColumn(name="task_id", referencedColumnName="id", nullable=true)}
  93. * )
  94. */
  95. private $tasks;
  96.  
  97. public function __construct(){
  98. $this->tags = new \Doctrine\Common\Collections\ArrayCollection();
  99. $this->tasks = new \Doctrine\Common\Collections\ArrayCollection();
  100. }
  101.  
  102.  
  103. /**
  104. * Add tasks
  105. *
  106. * @param Ev\MyEvBundle\Entity\Task $tasks
  107. */
  108. public function addTask(\Ev\MyEvBundle\Entity\Task $tasks)
  109. {
  110. $this->tasks[] = $tasks;
  111. }
  112.  
  113. /**
  114. * Get tasks
  115. *
  116. * @return Doctrine\Common\Collections\Collection
  117. */
  118. public function getTasks()
  119. {
  120. return $this->tasks;
  121. }
  122.  
  123. /**
  124. * Set Tasks
  125. *
  126. * @param Doctrine\Common\Collections\Collection $tasks
  127. */
  128. public function setTasks(\Ev\MyEvBundle\Entity\User $tasks)
  129. {
  130. $this->tasks = $tasks;
  131. }
Add Comment
Please, Sign In to add comment