src/Entity/Delete/Invoice.php line 44
<?php
namespace App\Entity\Delete;
use ApiPlatform\Doctrine\Orm\Filter\SearchFilter;
use ApiPlatform\Metadata\ApiFilter;
use ApiPlatform\Metadata\ApiProperty;
use ApiPlatform\Metadata\ApiResource;
use ApiPlatform\Metadata\Delete;
use ApiPlatform\Metadata\Get;
use ApiPlatform\Metadata\GetCollection;
use ApiPlatform\Metadata\Link;
use ApiPlatform\Metadata\Patch;
use ApiPlatform\Metadata\Post;
use App\Entity\Common as Common;
use DateTimeInterface;
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_invoice')]
#[ORM\Entity]
#[ApiResource(
operations: [
new Get(),
new Delete(),
new Patch(inputFormats: ['json' => ['application/merge-patch+json']]),
],
)]
#[ApiResource(
uriTemplate: '/invoicing/consolidations/{consolidation}/invoices',
operations: [
new Post(),
new GetCollection(),
],
uriVariables: [
'consolidation' => new Link(fromProperty: 'invoices', fromClass: Consolidation::class)
],
)]
#[ApiFilter(SearchFilter::class, properties: [
'reference' => 'ipartial',
])]
class Invoice extends Invoiceable
{
use Common\Blameable;
use Common\Trackable;
#[ORM\Id]
#[ORM\GeneratedValue(strategy: 'IDENTITY')]
#[ORM\SequenceGenerator(sequenceName: 'invoicing_invoice_id_seq')]
#[ORM\Column(type: Types::INTEGER)]
#[ApiProperty(identifier: false)]
private int $id;
#[ORM\ManyToOne(targetEntity: Consolidation::class, inversedBy: 'invoices')]
#[ORM\JoinColumn(name: 'batch_id', nullable: false)]
#[ApiProperty(readableLink: true)]
private ?Consolidation $consolidation = null;
#[Gedmo\Slug(fields: ['reference'])]
#[ORM\Column(type: Types::STRING)]
#[ApiProperty(identifier: true)]
private string $slug;
#[Assert\NotNull]
#[Assert\Type(type: Types::BOOLEAN)]
#[ORM\Column(type: Types::BOOLEAN)]
private ?bool $combined = null;
#[Assert\NotNull]
#[Assert\Type(type: Types::BOOLEAN)]
#[ORM\Column(type: Types::BOOLEAN)]
private ?bool $invoiced = null;
#[Assert\Type(type: DateTimeInterface::class)]
#[ORM\Column(type: Types::DATE_MUTABLE, nullable: true)]
private ?DateTimeInterface $atc = null;
#[Assert\NotNull]
#[ORM\Column(type: Types::JSON)]
private ?array $data = [];
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 isCombined(): ?bool
{
return $this->combined;
}
public function setCombined(bool $combined): self
{
$this->combined = $combined;
return $this;
}
public function isInvoiced(): ?bool
{
return $this->invoiced;
}
public function setInvoiced(bool $invoiced): self
{
$this->invoiced = $invoiced;
return $this;
}
public function getAtc(): ?DateTimeInterface
{
return $this->atc;
}
public function setAtc(?DateTimeInterface $atc): self
{
$this->atc = $atc;
return $this;
}
public function getConsolidation(): ?Consolidation
{
return $this->consolidation;
}
public function setConsolidation(?Consolidation $consolidation): self
{
$this->consolidation = $consolidation;
return $this;
}
public function getData(): array
{
return $this->data;
}
public function setData(?array $data): self
{
$this->data = $data;
return $this;
}
}