src/Entity/ZoneLivraison.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use ApiPlatform\Metadata\ApiResource;
  4. use App\Repository\ZoneLivraisonRepository;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\ORM\Mapping as ORM;
  8. #[ORM\Entity(repositoryClass: ZoneLivraisonRepository::class)]
  9. #[ApiResource]
  10. class ZoneLivraison
  11. {
  12. #[ORM\Id]
  13. #[ORM\GeneratedValue]
  14. #[ORM\Column]
  15. private ?int $id = null;
  16. #[ORM\Column(length: 255)]
  17. private ?string $libellezone = null;
  18. #[ORM\OneToMany(mappedBy: 'zonelivraison', targetEntity: Livraisons::class)]
  19. private Collection $livraisons;
  20. #[ORM\OneToMany(mappedBy: 'zonearrivee', targetEntity: Livraisons::class)]
  21. private Collection $livraisonsarrivee;
  22. public function __construct()
  23. {
  24. $this->livraisons = new ArrayCollection();
  25. $this->livraisonsarrivee = new ArrayCollection();
  26. }
  27. public function getId(): ?int
  28. {
  29. return $this->id;
  30. }
  31. public function getLibellezone(): ?string
  32. {
  33. return $this->libellezone;
  34. }
  35. public function setLibellezone(string $libellezone): static
  36. {
  37. $this->libellezone = $libellezone;
  38. return $this;
  39. }
  40. public function __toString(): string
  41. {
  42. return $this->libellezone; // Return a string representation
  43. }
  44. /**
  45. * @return Collection<int, Livraisons>
  46. */
  47. public function getLivraisons(): Collection
  48. {
  49. return $this->livraisons;
  50. }
  51. public function addLivraison(Livraisons $livraison): static
  52. {
  53. if (!$this->livraisons->contains($livraison)) {
  54. $this->livraisons->add($livraison);
  55. $livraison->setZonelivraison($this);
  56. }
  57. return $this;
  58. }
  59. public function removeLivraison(Livraisons $livraison): static
  60. {
  61. if ($this->livraisons->removeElement($livraison)) {
  62. // set the owning side to null (unless already changed)
  63. if ($livraison->getZonelivraison() === $this) {
  64. $livraison->setZonelivraison(null);
  65. }
  66. }
  67. return $this;
  68. }
  69. /**
  70. * @return Collection<int, Livraisons>
  71. */
  72. public function getLivraisonsarrivee(): Collection
  73. {
  74. return $this->livraisonsarrivee;
  75. }
  76. public function addLivraisonsarrivee(Livraisons $livraisonsarrivee): static
  77. {
  78. if (!$this->livraisonsarrivee->contains($livraisonsarrivee)) {
  79. $this->livraisonsarrivee->add($livraisonsarrivee);
  80. $livraisonsarrivee->setZonearrivee($this);
  81. }
  82. return $this;
  83. }
  84. public function removeLivraisonsarrivee(Livraisons $livraisonsarrivee): static
  85. {
  86. if ($this->livraisonsarrivee->removeElement($livraisonsarrivee)) {
  87. // set the owning side to null (unless already changed)
  88. if ($livraisonsarrivee->getZonearrivee() === $this) {
  89. $livraisonsarrivee->setZonearrivee(null);
  90. }
  91. }
  92. return $this;
  93. }
  94. }