Files
Ferme/src/Entity/BovineTypeShipment.php

111 lines
2.6 KiB
PHP

<?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 BovineTypeShipment
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
#[Groups(['shipment:read', 'bovine-type:read'])]
private ?int $id = null;
#[ORM\Column(length: 255)]
#[Groups(['shipment:read', 'shipment:write', 'bovine-type:read', 'bovine-type:write'])]
private ?string $type_label = null;
#[ORM\Column(length: 255)]
#[Groups(['shipment:read', 'shipment:write', 'bovine-type:read', 'bovine-type:write'])]
private ?string $type_code = null;
/**
* @var Collection<int, BovinShipment>
*/
#[ORM\OneToMany(targetEntity: BovinShipment::class, mappedBy: 'id_type')]
#[Groups(['shipment:read', 'shipment:write', 'bovine-type:read', 'bovine-type:write'])]
private Collection $bovinShipments;
public function __construct()
{
$this->bovinShipments = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getTypeLabel(): ?string
{
return $this->type_label;
}
public function setTypeLabel(string $type_label): static
{
$this->type_label = $type_label;
return $this;
}
public function getTypeCode(): ?string
{
return $this->type_code;
}
public function setTypeCode(string $type_code): static
{
$this->type_code = $type_code;
return $this;
}
public function getBovineShipment(): ?BovineShipment
{
return $this->bovineShipment;
}
public function setBovineShipment(?BovineShipment $bovineShipment): static
{
$this->bovineShipment = $bovineShipment;
return $this;
}
/**
* @return Collection<int, BovinShipment>
*/
public function getBovinShipments(): Collection
{
return $this->bovinShipments;
}
public function addBovinShipment(BovinShipment $bovinShipment): static
{
if (!$this->bovinShipments->contains($bovinShipment)) {
$this->bovinShipments->add($bovinShipment);
$bovinShipment->setIdType($this);
}
return $this;
}
public function removeBovinShipment(BovinShipment $bovinShipment): static
{
if ($this->bovinShipments->removeElement($bovinShipment)) {
// set the owning side to null (unless already changed)
if ($bovinShipment->getIdType() === $this) {
$bovinShipment->setIdType(null);
}
}
return $this;
}
}