feat : mise à jour du bon de réception wip
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user