src/Entity/Delete/Consolidation.php line 26
<?php
namespace App\Entity\Delete;
use ApiPlatform\Doctrine\Orm\Filter\SearchFilter;
use ApiPlatform\Metadata\ApiFilter;
use ApiPlatform\Metadata\ApiProperty;
use ApiPlatform\Metadata\ApiResource;
use App\Entity\Common as Common;
use App\Entity\Identity\User;
use DateTimeInterface;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
use Symfony\Component\Validator\Constraints as Assert;
#[ORM\Table(name: 'invoicing_batch')]
#[ORM\Entity]
#[ApiResource(routePrefix: '/invoicing')]
#[ApiFilter(SearchFilter::class, properties: [
'reference' => 'ipartial',
'status' => 'ipartial',
])]
class Consolidation
{
use Common\Blameable;
use Common\Trackable;
#[ORM\Id]
#[ORM\GeneratedValue(strategy: 'IDENTITY')]
#[ORM\SequenceGenerator(sequenceName: 'invoicing_batch_id_seq')]
#[ORM\Column(type: Types::INTEGER)]
#[ApiProperty(identifier: false)]
private int $id;
#[Gedmo\Slug(fields: ['reference'])]
#[ORM\Column(type: Types::STRING)]
#[ApiProperty(identifier: true)]
private string $slug;
#[Assert\NotBlank]
#[Assert\Type(type: Types::STRING)]
#[ORM\Column(type: Types::STRING)]
private ?string $reference = null;
#[Assert\NotBlank]
#[Assert\Type(type: Types::STRING)]
#[ORM\Column(type: Types::STRING)]
private ?string $status = null;
#[Assert\NotBlank]
#[Assert\Type(type: Types::STRING)]
#[ORM\Column(type: Types::STRING, nullable: true)]
private ?string $departureCountryCode = null;
#[Assert\NotBlank]
#[Assert\Type(type: Types::STRING)]
#[ORM\Column(type: Types::STRING, nullable: true)]
private ?string $destination = null;
#[Assert\NotBlank]
#[Assert\Type(type: Types::STRING)]
#[ORM\Column(type: Types::STRING, nullable: true)]
private ?string $transportMode = null;
#[Assert\NotBlank]
#[Assert\Type(type: Types::STRING)]
#[ORM\Column(type: Types::STRING, nullable: true)]
private ?string $billNumber = null;
#[Assert\NotBlank]
#[Assert\Type(type: Types::STRING)]
#[ORM\Column(type: Types::STRING, nullable: true)]
private ?string $vessel = null;
#[ORM\Column(type: Types::DECIMAL, precision: 18, scale: 5, nullable: true)]
private ?string $emptyContainersWeight = null;
#[Assert\NotNull]
#[ORM\Column(type: Types::JSON, nullable: true)]
private ?array $containers = [];
#[Assert\Type(type: Types::BOOLEAN)]
#[ORM\Column(type: Types::BOOLEAN, nullable: true)]
private ?bool $isDg = null;
#[Assert\Type(type: Types::BOOLEAN)]
#[ORM\Column(type: Types::BOOLEAN, nullable: true)]
private ?bool $isBreakBulk = null;
#[Assert\Type(type: Types::STRING)]
#[ORM\Column(type: Types::STRING, nullable: true)]
private ?string $tariffZone = null;
#[Assert\Type(type: DateTimeInterface::class)]
#[ORM\Column(type: Types::DATE_MUTABLE, nullable: true)]
private ?DateTimeInterface $atd = null;
#[Assert\Type(type: DateTimeInterface::class)]
#[ORM\Column(type: Types::DATE_MUTABLE, nullable: true)]
private ?DateTimeInterface $ata = null;
/** @var Collection<int, Invoice> */
#[ORM\OneToMany(mappedBy: 'consolidation', targetEntity: Invoice::class, cascade: ['persist', 'remove'])]
private Collection $invoices;
#[Gedmo\Blameable(on: 'create')]
#[ORM\ManyToOne(targetEntity: User::class)]
#[ORM\JoinColumn(name: 'created_by', nullable: true)]
protected ?User $createdBy = null;
public function __construct()
{
$this->invoices = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getSlug(): ?string
{
return $this->slug;
}
public function setSlug(string $slug): self
{
$this->slug = $slug;
return $this;
}
public function getReference(): ?string
{
return $this->reference;
}
public function setReference(string $reference): self
{
$this->reference = $reference;
return $this;
}
public function getDepartureCountryCode(): ?string
{
return $this->departureCountryCode;
}
public function setDepartureCountryCode(string $departureCountryCode): self
{
$this->departureCountryCode = $departureCountryCode;
return $this;
}
public function getDestination(): ?string
{
return $this->destination;
}
public function setDestination(string $destination): self
{
$this->destination = $destination;
return $this;
}
public function getStatus(): ?string
{
return $this->status;
}
public function setStatus(string $status): self
{
$this->status = $status;
return $this;
}
public function getTransportMode(): ?string
{
return $this->transportMode;
}
public function setTransportMode(string $transportMode): self
{
$this->transportMode = $transportMode;
return $this;
}
public function getBillNumber(): ?string
{
return $this->billNumber;
}
public function setBillNumber(string $billNumber): self
{
$this->billNumber = $billNumber;
return $this;
}
public function getVessel(): ?string
{
return $this->vessel;
}
public function setVessel(string $vessel): self
{
$this->vessel = $vessel;
return $this;
}
public function getEmptyContainersWeight(): ?string
{
return $this->emptyContainersWeight;
}
public function setEmptyContainersWeight(?string $emptyContainersWeight): self
{
$this->emptyContainersWeight = $emptyContainersWeight;
return $this;
}
public function getContainers(): array
{
return $this->containers;
}
public function setContainers(?array $containers): self
{
$this->containers = $containers;
return $this;
}
public function isDg(): ?bool
{
return $this->isDg;
}
public function setIsDg(bool $isDg): self
{
$this->isDg = $isDg;
return $this;
}
public function isBreakBulk(): ?bool
{
return empty($this->containers);
}
public function setIsBreakBulk(bool $isBreakBulk): self
{
$this->isBreakBulk = $isBreakBulk;
return $this;
}
public function getTariffZone(): ?string
{
return $this->tariffZone;
}
public function setTariffZone(string $tariffZone): self
{
$this->tariffZone = $tariffZone;
return $this;
}
public function getAtd(): ?DateTimeInterface
{
return $this->atd;
}
public function setAtd(?DateTimeInterface $atd): self
{
$this->atd = $atd;
return $this;
}
public function getAta(): ?DateTimeInterface
{
return $this->ata;
}
public function setAta(?DateTimeInterface $ata): self
{
$this->ata = $ata;
return $this;
}
/**
* @return Collection<int, Invoice>
*/
public function getInvoices(): Collection
{
return $this->invoices;
}
public function addInvoice(Invoice $invoice): self
{
if (!$this->invoices->contains($invoice)) {
$this->invoices->add($invoice);
$invoice->setConsolidation($this);
}
return $this;
}
public function removeInvoice(Invoice $invoice): self
{
if ($this->invoices->removeElement($invoice)) {
// set the owning side to null (unless already changed)
if ($invoice->getConsolidation() === $this) {
$invoice->setConsolidation(null);
}
}
return $this;
}
}