feat : ajout d'une page de creation d'une expedition

This commit is contained in:
2026-02-11 16:12:33 +01:00
parent 0181d72144
commit 5f4139fde3
31 changed files with 1292 additions and 356 deletions

View File

@@ -31,7 +31,7 @@ class Address
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
#[Groups(['address:read', 'supplier:read'])]
#[Groups(['address:read', 'supplier:read', 'customer:read', 'shipment:read'])]
private ?int $id = null;
#[ORM\Column(length: 120)]
@@ -64,9 +64,16 @@ class Address
#[ORM\ManyToMany(targetEntity: Supplier::class, mappedBy: 'addresses')]
private Collection $suppliers;
/**
* @var Collection<int, Shipment>
*/
#[ORM\OneToMany(targetEntity: Shipment::class, mappedBy: 'address')]
private Collection $shipments;
public function __construct()
{
$this->suppliers = new ArrayCollection();
$this->shipments = new ArrayCollection();
}
public function getId(): ?int
@@ -146,7 +153,7 @@ class Address
return $this;
}
#[Groups(['address:read', 'supplier:read', 'reception:read', 'customer:read'])]
#[Groups(['address:read', 'supplier:read', 'reception:read', 'shipment:read', 'customer:read'])]
public function getFullAddress(): string
{
$parts = array_filter([
@@ -165,4 +172,34 @@ class Address
{
return $this->suppliers;
}
/**
* @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->setAddress($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->getAddress() === $this) {
$shipment->setAddress(null);
}
}
return $this;
}
}