<?php
namespace App\Entity;
use ApiPlatform\Metadata\ApiResource;
use App\Repository\TypeTransportRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: TypeTransportRepository::class)]
#[ApiResource]
class TypeTransport
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255)]
private ?string $matricule = null;
#[ORM\Column(length: 255)]
private ?string $couleur = null;
#[ORM\Column(length: 255)]
private ?string $libelle = null;
#[ORM\Column(length: 255)]
private ?string $marque = null;
#[ORM\Column]
private ?int $max_poids = null;
#[ORM\OneToMany(mappedBy: 'id_TypeTransport', targetEntity: Livreurs::class)]
private Collection $livreurs;
public function __construct()
{
$this->livreurs = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getLibelle(): ?string
{
return $this->libelle;
}
public function setLibelle(string $libelle)
{
$this->libelle = $libelle;
return $this;
}
public function getMaxPoids(): ?int
{
return $this->max_poids;
}
public function setMaxPoids(int $max_poids)
{
$this->max_poids = $max_poids;
return $this;
}
/**
* @return Collection<int, Livreurs>
*/
public function getLivreurs(): Collection
{
return $this->livreurs;
}
public function addLivreur(Livreurs $livreur): static
{
if (!$this->livreurs->contains($livreur)) {
$this->livreurs->add($livreur);
$livreur->setIdTypeTransport($this);
}
return $this;
}
public function removeLivreur(Livreurs $livreur): static
{
if ($this->livreurs->removeElement($livreur)) {
// set the owning side to null (unless already changed)
if ($livreur->getIdTypeTransport() === $this) {
$livreur->setIdTypeTransport(null);
}
}
return $this;
}
public function getMatricule(): ?string
{
return $this->matricule;
}
public function setMatricule(string $matricule): static
{
$this->matricule = $matricule;
return $this;
}
public function getCouleur(): ?string
{
return $this->couleur;
}
public function setCouleur(string $couleur): static
{
$this->couleur = $couleur;
return $this;
}
public function getMarque(): ?string
{
return $this->marque;
}
public function setMarque(string $marque): static
{
$this->marque = $marque;
return $this;
}
public function __toString(): string
{
return $this->libelle; // Return a string representation
}
}