feat : Expedition dev back-end WIP
This commit is contained in:
@@ -7,8 +7,6 @@ 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;
|
||||
|
||||
@@ -31,35 +29,17 @@ class Carrier
|
||||
#[ORM\Id]
|
||||
#[ORM\GeneratedValue]
|
||||
#[ORM\Column]
|
||||
#[Groups(['carrier:read', 'driver:read', 'vehicle:read', 'reception:read'])]
|
||||
#[Groups(['carrier:read', 'driver:read', 'vehicle:read', 'reception:read', 'shipment:read'])]
|
||||
private ?int $id = null;
|
||||
|
||||
#[ORM\Column(length: 180)]
|
||||
#[Groups(['carrier:read', 'driver:read', 'vehicle:read', 'reception:read'])]
|
||||
#[Groups(['carrier:read', 'driver:read', 'vehicle:read', 'reception:read', 'shipment:read'])]
|
||||
private string $name = '';
|
||||
|
||||
#[ORM\Column(length: 30, nullable: true)]
|
||||
#[Groups(['carrier:read', 'driver:read', 'vehicle:read', 'reception:read'])]
|
||||
#[Groups(['carrier:read', 'driver:read', 'vehicle:read', 'reception:read', 'shipment: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;
|
||||
@@ -88,64 +68,4 @@ 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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user