Advertisement
Guest User

Untitled

a guest
Dec 15th, 2019
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.90 KB | None | 0 0
  1. <?php
  2.  
  3. namespace App\Entity;
  4.  
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\ORM\Mapping as ORM;
  8.  
  9. /**
  10. * @ORM\Entity(repositoryClass="App\Repository\RestaurantsRepository")
  11. */
  12. class Restaurants
  13. {
  14. /**
  15. * @ORM\Id()
  16. * @ORM\GeneratedValue()
  17. * @ORM\Column(type="integer")
  18. */
  19. private $id;
  20.  
  21. /**
  22. * @ORM\Column(type="string", length=255)
  23. */
  24. private $libelle;
  25.  
  26. /**
  27. * @ORM\Column(type="text")
  28. */
  29. private $avatar;
  30.  
  31. /**
  32. * @ORM\Column(type="string", length=255)
  33. */
  34. private $ville;
  35.  
  36. /**
  37. * @ORM\Column(type="integer")
  38. */
  39. private $codePostal;
  40.  
  41. /**
  42. * @ORM\Column(type="text")
  43. */
  44. private $localisation;
  45.  
  46. /**
  47. * @ORM\OneToMany(targetEntity="App\Entity\Menu", mappedBy="resto")
  48. */
  49. private $menus;
  50.  
  51. public function __construct()
  52. {
  53. $this->menus = new ArrayCollection();
  54. }
  55.  
  56. public function getId(): ?int
  57. {
  58. return $this->id;
  59. }
  60.  
  61. public function getLibelle(): ?string
  62. {
  63. return $this->libelle;
  64. }
  65.  
  66. public function setLibelle(string $libelle): self
  67. {
  68. $this->libelle = $libelle;
  69.  
  70. return $this;
  71. }
  72.  
  73. public function getAvatar(): ?string
  74. {
  75. return $this->avatar;
  76. }
  77.  
  78. public function setAvatar(string $avatar): self
  79. {
  80. $this->avatar = $avatar;
  81.  
  82. return $this;
  83. }
  84.  
  85. public function getVille(): ?string
  86. {
  87. return $this->ville;
  88. }
  89.  
  90. public function setVille(string $ville): self
  91. {
  92. $this->ville = $ville;
  93.  
  94. return $this;
  95. }
  96.  
  97. public function getCodePostal(): ?int
  98. {
  99. return $this->codePostal;
  100. }
  101.  
  102. public function setCodePostal(int $codePostal): self
  103. {
  104. $this->codePostal = $codePostal;
  105.  
  106. return $this;
  107. }
  108.  
  109. public function getLocalisation(): ?string
  110. {
  111. return $this->localisation;
  112. }
  113.  
  114. public function setLocalisation(string $localisation): self
  115. {
  116. $this->localisation = $localisation;
  117.  
  118. return $this;
  119. }
  120.  
  121. /**
  122. * @return Collection|Menu[]
  123. */
  124. public function getMenus(): Collection
  125. {
  126. return $this->menus;
  127. }
  128.  
  129. public function addMenu(Menu $menu): self
  130. {
  131. if (!$this->menus->contains($menu)) {
  132. $this->menus[] = $menu;
  133. $menu->setResto($this);
  134. }
  135.  
  136. return $this;
  137. }
  138.  
  139. public function removeMenu(Menu $menu): self
  140. {
  141. if ($this->menus->contains($menu)) {
  142. $this->menus->removeElement($menu);
  143. // set the owning side to null (unless already changed)
  144. if ($menu->getResto() === $this) {
  145. $menu->setResto(null);
  146. }
  147. }
  148.  
  149. return $this;
  150. }
  151.  
  152. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement