src/Entity/TypeTransport.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use ApiPlatform\Metadata\ApiResource;
  4. use App\Repository\TypeTransportRepository;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\ORM\Mapping as ORM;
  8. #[ORM\Entity(repositoryClass: TypeTransportRepository::class)]
  9. #[ApiResource]
  10. class TypeTransport
  11. {
  12. #[ORM\Id]
  13. #[ORM\GeneratedValue]
  14. #[ORM\Column]
  15. private ?int $id = null;
  16. #[ORM\Column(length: 255)]
  17. private ?string $matricule = null;
  18. #[ORM\Column(length: 255)]
  19. private ?string $couleur = null;
  20. #[ORM\Column(length: 255)]
  21. private ?string $libelle = null;
  22. #[ORM\Column(length: 255)]
  23. private ?string $marque = null;
  24. #[ORM\Column]
  25. private ?int $max_poids = null;
  26. #[ORM\OneToMany(mappedBy: 'id_TypeTransport', targetEntity: Livreurs::class)]
  27. private Collection $livreurs;
  28. public function __construct()
  29. {
  30. $this->livreurs = new ArrayCollection();
  31. }
  32. public function getId(): ?int
  33. {
  34. return $this->id;
  35. }
  36. public function getLibelle(): ?string
  37. {
  38. return $this->libelle;
  39. }
  40. public function setLibelle(string $libelle)
  41. {
  42. $this->libelle = $libelle;
  43. return $this;
  44. }
  45. public function getMaxPoids(): ?int
  46. {
  47. return $this->max_poids;
  48. }
  49. public function setMaxPoids(int $max_poids)
  50. {
  51. $this->max_poids = $max_poids;
  52. return $this;
  53. }
  54. /**
  55. * @return Collection<int, Livreurs>
  56. */
  57. public function getLivreurs(): Collection
  58. {
  59. return $this->livreurs;
  60. }
  61. public function addLivreur(Livreurs $livreur): static
  62. {
  63. if (!$this->livreurs->contains($livreur)) {
  64. $this->livreurs->add($livreur);
  65. $livreur->setIdTypeTransport($this);
  66. }
  67. return $this;
  68. }
  69. public function removeLivreur(Livreurs $livreur): static
  70. {
  71. if ($this->livreurs->removeElement($livreur)) {
  72. // set the owning side to null (unless already changed)
  73. if ($livreur->getIdTypeTransport() === $this) {
  74. $livreur->setIdTypeTransport(null);
  75. }
  76. }
  77. return $this;
  78. }
  79. public function getMatricule(): ?string
  80. {
  81. return $this->matricule;
  82. }
  83. public function setMatricule(string $matricule): static
  84. {
  85. $this->matricule = $matricule;
  86. return $this;
  87. }
  88. public function getCouleur(): ?string
  89. {
  90. return $this->couleur;
  91. }
  92. public function setCouleur(string $couleur): static
  93. {
  94. $this->couleur = $couleur;
  95. return $this;
  96. }
  97. public function getMarque(): ?string
  98. {
  99. return $this->marque;
  100. }
  101. public function setMarque(string $marque): static
  102. {
  103. $this->marque = $marque;
  104. return $this;
  105. }
  106. public function __toString(): string
  107. {
  108. return $this->libelle; // Return a string representation
  109. }
  110. }