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