feat : mise à jour du bon de réception wip
This commit is contained in:
@@ -7,6 +7,8 @@ namespace App\Entity;
|
||||
use ApiPlatform\Metadata\ApiResource;
|
||||
use ApiPlatform\Metadata\Get;
|
||||
use ApiPlatform\Metadata\GetCollection;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Component\Serializer\Attribute\Groups;
|
||||
|
||||
@@ -40,6 +42,24 @@ class Carrier
|
||||
#[Groups(['carrier:read', 'driver:read', 'vehicle:read', 'reception:read'])]
|
||||
private ?string $code = null;
|
||||
|
||||
/**
|
||||
* @var Collection<int, Shipment>
|
||||
*/
|
||||
#[ORM\OneToMany(targetEntity: Shipment::class, mappedBy: 'id_carrier')]
|
||||
private Collection $id_carrier_1;
|
||||
|
||||
/**
|
||||
* @var Collection<int, Shipment>
|
||||
*/
|
||||
#[ORM\OneToMany(targetEntity: Shipment::class, mappedBy: 'licence_plate_1')]
|
||||
private Collection $shipments;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->id_carrier_1 = new ArrayCollection();
|
||||
$this->shipments = new ArrayCollection();
|
||||
}
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
@@ -68,4 +88,64 @@ class Carrier
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<int, Shipment>
|
||||
*/
|
||||
public function getIdCarrier1(): Collection
|
||||
{
|
||||
return $this->id_carrier_1;
|
||||
}
|
||||
|
||||
public function addIdCarrier1(Shipment $idCarrier1): static
|
||||
{
|
||||
if (!$this->id_carrier_1->contains($idCarrier1)) {
|
||||
$this->id_carrier_1->add($idCarrier1);
|
||||
$idCarrier1->setIdCarrier($this);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removeIdCarrier1(Shipment $idCarrier1): static
|
||||
{
|
||||
if ($this->id_carrier_1->removeElement($idCarrier1)) {
|
||||
// set the owning side to null (unless already changed)
|
||||
if ($idCarrier1->getIdCarrier() === $this) {
|
||||
$idCarrier1->setIdCarrier(null);
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<int, Shipment>
|
||||
*/
|
||||
public function getShipments(): Collection
|
||||
{
|
||||
return $this->shipments;
|
||||
}
|
||||
|
||||
public function addShipment(Shipment $shipment): static
|
||||
{
|
||||
if (!$this->shipments->contains($shipment)) {
|
||||
$this->shipments->add($shipment);
|
||||
$shipment->setLicencePlate1($this);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removeShipment(Shipment $shipment): static
|
||||
{
|
||||
if ($this->shipments->removeElement($shipment)) {
|
||||
// set the owning side to null (unless already changed)
|
||||
if ($shipment->getLicencePlate1() === $this) {
|
||||
$shipment->setLicencePlate1(null);
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user