feat : mise à jour du bon de réception wip

This commit is contained in:
2026-02-03 17:16:19 +01:00
parent 13e8698673
commit 5fd2ab8470
7 changed files with 200 additions and 34 deletions

View File

@@ -64,9 +64,16 @@ class Address
#[ORM\ManyToMany(targetEntity: Supplier::class, mappedBy: 'addresses')]
private Collection $suppliers;
/**
* @var Collection<int, Customer>
*/
#[ORM\OneToMany(targetEntity: Customer::class, mappedBy: 'id_adress')]
private Collection $customers;
public function __construct()
{
$this->suppliers = new ArrayCollection();
$this->customers = new ArrayCollection();
}
public function getId(): ?int
@@ -165,4 +172,34 @@ class Address
{
return $this->suppliers;
}
/**
* @return Collection<int, Customer>
*/
public function getCustomers(): Collection
{
return $this->customers;
}
public function addCustomer(Customer $customer): static
{
if (!$this->customers->contains($customer)) {
$this->customers->add($customer);
$customer->setIdAdress($this);
}
return $this;
}
public function removeCustomer(Customer $customer): static
{
if ($this->customers->removeElement($customer)) {
// set the owning side to null (unless already changed)
if ($customer->getIdAdress() === $this) {
$customer->setIdAdress(null);
}
}
return $this;
}
}

View File

@@ -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;
}
}

View File

@@ -8,6 +8,8 @@ use ApiPlatform\Metadata\ApiProperty;
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;
@@ -49,6 +51,17 @@ class Vehicle
#[ApiProperty(readableLink: true)]
private ?Truck $truck = null;
/**
* @var Collection<int, Shipment>
*/
#[ORM\OneToMany(targetEntity: Shipment::class, mappedBy: 'id_carrier_1')]
private Collection $shipments;
public function __construct()
{
$this->shipments = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
@@ -89,4 +102,34 @@ class Vehicle
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->setIdCarrier1($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->getIdCarrier1() === $this) {
$shipment->setIdCarrier1(null);
}
}
return $this;
}
}