src/Entity/Foodtruck.php line 12

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\FoodtruckRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\DBAL\Types\Types;
  7. use Doctrine\ORM\Mapping as ORM;
  8. #[ORM\Entity(repositoryClass: FoodtruckRepository::class)]
  9. class Foodtruck
  10. {
  11. #[ORM\Id]
  12. #[ORM\GeneratedValue]
  13. #[ORM\Column(type: 'integer')]
  14. private $id;
  15. #[ORM\Column(type: 'string',length: 255)]
  16. private $libelle;
  17. #[ORM\OneToMany(mappedBy: 'foodtruck', targetEntity: Preparation::class)]
  18. private $preparations;
  19. #[ORM\OneToMany(mappedBy: 'foodtruck', targetEntity: Service::class, orphanRemoval: true)]
  20. private $services;
  21. #[ORM\ManyToMany(targetEntity: User::class, inversedBy: 'foodtrucks')]
  22. private $users;
  23. #[ORM\Column(type: 'string', length: 255, nullable: true)]
  24. private $url;
  25. #[ORM\Column(type: 'string', length: 255, nullable: true)]
  26. private $logo;
  27. #[ORM\Column(type: 'string', length: 180, unique: true)]
  28. private $email;
  29. #[ORM\Column(type: 'string', length: 180, nullable: true)]
  30. private $phone_number;
  31. #[ORM\Column(type: Types::TEXT, nullable: true)]
  32. private $qrcode;
  33. #[ORM\OneToMany(mappedBy: 'foodtruck', targetEntity: Rotation::class, orphanRemoval: true)]
  34. private Collection $rotations;
  35. #[ORM\OneToMany(mappedBy: 'foodtruck', targetEntity: Terminal::class, orphanRemoval: true)]
  36. private Collection $terminals;
  37. #[ORM\Column(length: 255, nullable: true)]
  38. private ?string $formeJuridique = null;
  39. #[ORM\Column(length: 255, nullable: true)]
  40. private ?string $adresse = null;
  41. #[ORM\Column(length: 255, nullable: true)]
  42. private ?string $cp = null;
  43. #[ORM\Column(length: 255, nullable: true)]
  44. private ?string $ville = null;
  45. #[ORM\Column(length: 255, nullable: true)]
  46. private ?string $siret = null;
  47. #[ORM\Column(nullable: true)]
  48. private ?bool $tva = null;
  49. #[ORM\Column(nullable: true)]
  50. private ?int $prochainIndexCommande = 1;
  51. public function __construct()
  52. {
  53. $this->preparations = new ArrayCollection();
  54. $this->services = new ArrayCollection();
  55. $this->users = new ArrayCollection();
  56. $this->rotations = new ArrayCollection();
  57. $this->terminals = new ArrayCollection();
  58. }
  59. public function getId(): ?int
  60. {
  61. return $this->id;
  62. }
  63. public function getLibelle(): ?string
  64. {
  65. return $this->libelle;
  66. }
  67. public function setLibelle(string $libelle): self
  68. {
  69. $this->libelle = $libelle;
  70. return $this;
  71. }
  72. /**
  73. * @return Collection<int, Preparation>
  74. */
  75. public function getPreparations(): Collection
  76. {
  77. return $this->preparations;
  78. }
  79. public function addPreparation(Preparation $preparation): self
  80. {
  81. if (!$this->preparations->contains($preparation)) {
  82. $this->preparations->add($preparation);
  83. $preparation->setFoodtruck($this);
  84. }
  85. return $this;
  86. }
  87. public function removePreparation(Preparation $preparation): self
  88. {
  89. if ($this->preparations->removeElement($preparation)) {
  90. // set the owning side to null (unless already changed)
  91. if ($preparation->getFoodtruck() === $this) {
  92. $preparation->setFoodtruck(null);
  93. }
  94. }
  95. return $this;
  96. }
  97. /**
  98. * @return Collection<int, Service>
  99. */
  100. public function getServices(): Collection
  101. {
  102. return $this->services;
  103. }
  104. public function addService(Service $service): self
  105. {
  106. if (!$this->services->contains($service)) {
  107. $this->services->add($service);
  108. $service->setFoodtruck($this);
  109. }
  110. return $this;
  111. }
  112. public function removeService(Service $service): self
  113. {
  114. if ($this->services->removeElement($service)) {
  115. // set the owning side to null (unless already changed)
  116. if ($service->getFoodtruck() === $this) {
  117. $service->setFoodtruck(null);
  118. }
  119. }
  120. return $this;
  121. }
  122. /**
  123. * @return Collection<int, User>
  124. */
  125. public function getUsers(): Collection
  126. {
  127. return $this->users;
  128. }
  129. public function addUser(User $user): self
  130. {
  131. if (!$this->users->contains($user)) {
  132. $this->users->add($user);
  133. }
  134. return $this;
  135. }
  136. public function removeUser(User $user): self
  137. {
  138. $this->users->removeElement($user);
  139. return $this;
  140. }
  141. public function getUrl(): ?string
  142. {
  143. return $this->url;
  144. }
  145. public function setUrl(?string $url): self
  146. {
  147. $this->url = $url;
  148. return $this;
  149. }
  150. public function getLogo(): ?string
  151. {
  152. return $this->logo;
  153. }
  154. public function setLogo(?string $logo): self
  155. {
  156. $this->logo = $logo;
  157. return $this;
  158. }
  159. public function getEmail(): ?string
  160. {
  161. return $this->email;
  162. }
  163. public function setEmail(string $email): self
  164. {
  165. $this->email = $email;
  166. return $this;
  167. }
  168. public function getPhoneNumber(): ?string
  169. {
  170. return $this->phone_number;
  171. }
  172. public function setPhoneNumber(?string $phone_number): self
  173. {
  174. $this->phone_number = $phone_number;
  175. return $this;
  176. }
  177. public function getQrcode(): ?string
  178. {
  179. return $this->qrcode;
  180. }
  181. public function setQrcode(?string $qrcode): self
  182. {
  183. $this->qrcode = $qrcode;
  184. return $this;
  185. }
  186. /**
  187. * @return Collection<int, Rotation>
  188. */
  189. public function getRotations(): Collection
  190. {
  191. return $this->rotations;
  192. }
  193. public function addRotation(Rotation $rotation): self
  194. {
  195. if (!$this->rotations->contains($rotation)) {
  196. $this->rotations->add($rotation);
  197. $rotation->setFoodtruck($this);
  198. }
  199. return $this;
  200. }
  201. public function removeRotation(Rotation $rotation): self
  202. {
  203. if ($this->rotations->removeElement($rotation)) {
  204. // set the owning side to null (unless already changed)
  205. if ($rotation->getFoodtruck() === $this) {
  206. $rotation->setFoodtruck(null);
  207. }
  208. }
  209. return $this;
  210. }
  211. /**
  212. * @return Collection<int, Terminal>
  213. */
  214. public function getTerminals(): Collection
  215. {
  216. return $this->terminals;
  217. }
  218. public function addTerminal(Terminal $terminal): static
  219. {
  220. if (!$this->terminals->contains($terminal)) {
  221. $this->terminals->add($terminal);
  222. $terminal->setFoodtruck($this);
  223. }
  224. return $this;
  225. }
  226. public function removeTerminal(Terminal $terminal): static
  227. {
  228. if ($this->terminals->removeElement($terminal)) {
  229. // set the owning side to null (unless already changed)
  230. if ($terminal->getFoodtruck() === $this) {
  231. $terminal->setFoodtruck(null);
  232. }
  233. }
  234. return $this;
  235. }
  236. public function getFormeJuridique(): ?string
  237. {
  238. return $this->formeJuridique;
  239. }
  240. public function setFormeJuridique(?string $formeJuridique): static
  241. {
  242. $this->formeJuridique = $formeJuridique;
  243. return $this;
  244. }
  245. public function getAdresse(): ?string
  246. {
  247. return $this->adresse;
  248. }
  249. public function setAdresse(?string $adresse): static
  250. {
  251. $this->adresse = $adresse;
  252. return $this;
  253. }
  254. public function getCp(): ?string
  255. {
  256. return $this->cp;
  257. }
  258. public function setCp(?string $cp): static
  259. {
  260. $this->cp = $cp;
  261. return $this;
  262. }
  263. public function getVille(): ?string
  264. {
  265. return $this->ville;
  266. }
  267. public function setVille(?string $ville): static
  268. {
  269. $this->ville = $ville;
  270. return $this;
  271. }
  272. public function getSiret(): ?string
  273. {
  274. return $this->siret;
  275. }
  276. public function setSiret(?string $siret): static
  277. {
  278. $this->siret = $siret;
  279. return $this;
  280. }
  281. public function isTva(): ?bool
  282. {
  283. return $this->tva;
  284. }
  285. public function setTva(?bool $tva): static
  286. {
  287. $this->tva = $tva;
  288. return $this;
  289. }
  290. public function getProchainIndexCommande(): ?int
  291. {
  292. return $this->prochainIndexCommande;
  293. }
  294. public function setProchainIndexCommande(?int $prochainIndexCommande): static
  295. {
  296. $this->prochainIndexCommande = $prochainIndexCommande;
  297. return $this;
  298. }
  299. }