<?php
namespace App\Entity;
use ApiPlatform\Metadata\ApiResource;
use App\Repository\ZoneLivraisonRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: ZoneLivraisonRepository::class)]
#[ApiResource]
class ZoneLivraison
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255)]
private ?string $libellezone = null;
#[ORM\OneToMany(mappedBy: 'zonelivraison', targetEntity: Livraisons::class)]
private Collection $livraisons;
#[ORM\OneToMany(mappedBy: 'zonearrivee', targetEntity: Livraisons::class)]
private Collection $livraisonsarrivee;
public function __construct()
{
$this->livraisons = new ArrayCollection();
$this->livraisonsarrivee = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getLibellezone(): ?string
{
return $this->libellezone;
}
public function setLibellezone(string $libellezone): static
{
$this->libellezone = $libellezone;
return $this;
}
public function __toString(): string
{
return $this->libellezone; // Return a string representation
}
/**
* @return Collection<int, Livraisons>
*/
public function getLivraisons(): Collection
{
return $this->livraisons;
}
public function addLivraison(Livraisons $livraison): static
{
if (!$this->livraisons->contains($livraison)) {
$this->livraisons->add($livraison);
$livraison->setZonelivraison($this);
}
return $this;
}
public function removeLivraison(Livraisons $livraison): static
{
if ($this->livraisons->removeElement($livraison)) {
// set the owning side to null (unless already changed)
if ($livraison->getZonelivraison() === $this) {
$livraison->setZonelivraison(null);
}
}
return $this;
}
/**
* @return Collection<int, Livraisons>
*/
public function getLivraisonsarrivee(): Collection
{
return $this->livraisonsarrivee;
}
public function addLivraisonsarrivee(Livraisons $livraisonsarrivee): static
{
if (!$this->livraisonsarrivee->contains($livraisonsarrivee)) {
$this->livraisonsarrivee->add($livraisonsarrivee);
$livraisonsarrivee->setZonearrivee($this);
}
return $this;
}
public function removeLivraisonsarrivee(Livraisons $livraisonsarrivee): static
{
if ($this->livraisonsarrivee->removeElement($livraisonsarrivee)) {
// set the owning side to null (unless already changed)
if ($livraisonsarrivee->getZonearrivee() === $this) {
$livraisonsarrivee->setZonearrivee(null);
}
}
return $this;
}
}