feat : mise à jour du bon de réception WIP
This commit is contained in:
113
src/Entity/Customer.php
Normal file
113
src/Entity/Customer.php
Normal file
@@ -0,0 +1,113 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
#[ORM\Entity]
|
||||
class Customer
|
||||
{
|
||||
#[ORM\Id]
|
||||
#[ORM\GeneratedValue]
|
||||
#[ORM\Column]
|
||||
#[Groups(['shipment:read', 'customer:read'])]
|
||||
private ?int $id = null;
|
||||
|
||||
#[ORM\Column(length: 255)]
|
||||
#[Groups(['shipment:read', 'shipment:write', 'customer:read', 'customer:write'])]
|
||||
private ?string $customer_label = null;
|
||||
|
||||
#[ORM\Column(length: 255)]
|
||||
#[Groups(['shipment:read', 'shipment:write', 'customer:read', 'customer:write'])]
|
||||
private ?string $customer_code = null;
|
||||
|
||||
#[ORM\ManyToOne(inversedBy: 'customers')]
|
||||
#[Groups(['shipment:read', 'shipment:write', 'customer:read', 'customer:write'])]
|
||||
private ?Address $id_adress = null;
|
||||
|
||||
/**
|
||||
* @var Collection<int, Shipment>
|
||||
*/
|
||||
#[ORM\OneToMany(targetEntity: Shipment::class, mappedBy: 'id_customer')]
|
||||
private Collection $shipments;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->shipments = new ArrayCollection();
|
||||
}
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getCustomerLabel(): ?string
|
||||
{
|
||||
return $this->customer_label;
|
||||
}
|
||||
|
||||
public function setCustomerLabel(string $customer_label): static
|
||||
{
|
||||
$this->customer_label = $customer_label;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getCustomerCode(): ?string
|
||||
{
|
||||
return $this->customer_code;
|
||||
}
|
||||
|
||||
public function setCustomerCode(string $customer_code): static
|
||||
{
|
||||
$this->customer_code = $customer_code;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getIdAdress(): ?Address
|
||||
{
|
||||
return $this->id_adress;
|
||||
}
|
||||
|
||||
public function setIdAdress(?Address $id_adress): static
|
||||
{
|
||||
$this->id_adress = $id_adress;
|
||||
|
||||
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->setIdCustomer($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->getIdCustomer() === $this) {
|
||||
$shipment->setIdCustomer(null);
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user