src/Entity/Invoice.php line 14
<?php
namespace App\Entity;
use App\Repository\InvoiceRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
#[ORM\Entity(repositoryClass: InvoiceRepository::class)]
#[UniqueEntity('number')]
class Invoice
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\ManyToOne(inversedBy: 'invoices')]
private ?User $user = null;
#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]
private ?\DateTimeInterface $created = null;
#[ORM\Column(nullable: true)]
private ?int $year = null;
#[ORM\Column(type: Types::SMALLINT, nullable: true)]
private ?int $month = null;
#[ORM\Column(length: 255, unique: true, nullable: true)]
private ?string $number = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $formattedNumber = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $folder_path = null;
#[ORM\Column(length: 20, nullable: true)]
private ?string $subscriptionType = null;
#[ORM\Column(type: Types::DATE_MUTABLE, nullable: true)]
private ?\DateTimeInterface $billingDate = null;
#[ORM\Column(nullable: true)]
private ?bool $sentToEmail = null;
#[ORM\Column(nullable: true)]
private ?float $amount = null;
#[ORM\Column(length: 50, nullable: true)]
private ?string $orders = null;
#[ORM\OneToMany(mappedBy: 'invoice', targetEntity: InvoiceItem::class)]
private Collection $invoiceItems;
#[ORM\Column(length: 255, nullable: true)]
private ?string $contractNumber = null;
#[ORM\OneToMany(mappedBy: 'invoice', targetEntity: InvoicePayment::class)]
private Collection $invoicePayments;
public function __construct()
{
$this->invoiceItems = new ArrayCollection();
$this->invoicePayments = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getUser(): ?User
{
return $this->user;
}
public function setUser(?User $user): self
{
$this->user = $user;
return $this;
}
public function getCreated(): ?\DateTimeInterface
{
return $this->created;
}
public function setCreated(?\DateTimeInterface $created): self
{
$this->created = $created;
return $this;
}
public function getYear(): ?int
{
return $this->year;
}
public function setYear(?int $year): self
{
$this->year = $year;
return $this;
}
public function getMonth(): ?int
{
return $this->month;
}
public function setMonth(?int $month): self
{
$this->month = $month;
return $this;
}
public function getNumber(): ?string
{
return $this->number;
}
public function setNumber(?string $number): self
{
$this->number = $number;
return $this;
}
public function getFormattedNumber(): ?string
{
return $this->formattedNumber;
}
public function setFormattedNumber(?string $formattedNumber): self
{
$this->formattedNumber = $formattedNumber;
return $this;
}
public function getFolderPath(): ?string
{
return $this->folder_path;
}
public function setFolderPath(?string $folder_path): self
{
$this->folder_path = $folder_path;
return $this;
}
public function getSubscriptionType(): ?string
{
return $this->subscriptionType;
}
public function setSubscriptionType(?string $subscriptionType): self
{
$this->subscriptionType = $subscriptionType;
return $this;
}
public function getBillingDate(): ?\DateTimeInterface
{
return $this->billingDate;
}
public function setBillingDate(?\DateTimeInterface $billingDate): self
{
$this->billingDate = $billingDate;
return $this;
}
public function isSentToEmail(): ?bool
{
return $this->sentToEmail;
}
public function setSentToEmail(?bool $sentToEmail): static
{
$this->sentToEmail = $sentToEmail;
return $this;
}
public function getAmount(): ?float
{
return $this->amount;
}
public function setAmount(?float $amount): static
{
$this->amount = $amount;
return $this;
}
public function getOrders(): ?string
{
return $this->orders;
}
public function setOrders(?string $orders): static
{
$this->orders = $orders;
return $this;
}
/**
* @return Collection<int, InvoiceItem>
*/
public function getInvoiceItems(): Collection
{
return $this->invoiceItems;
}
public function addInvoiceItem(InvoiceItem $invoiceItem): static
{
if (!$this->invoiceItems->contains($invoiceItem)) {
$this->invoiceItems->add($invoiceItem);
$invoiceItem->setInvoice($this);
}
return $this;
}
public function removeInvoiceItem(InvoiceItem $invoiceItem): static
{
if ($this->invoiceItems->removeElement($invoiceItem)) {
// set the owning side to null (unless already changed)
if ($invoiceItem->getInvoice() === $this) {
$invoiceItem->setInvoice(null);
}
}
return $this;
}
public function getContractNumber(): ?string
{
return $this->contractNumber;
}
public function setContractNumber(?string $contractNumber): static
{
$this->contractNumber = $contractNumber;
return $this;
}
/**
* @return Collection<int, InvoicePayment>
*/
public function getInvoicePayments(): Collection
{
return $this->invoicePayments;
}
public function addInvoicePayment(InvoicePayment $invoicePayment): static
{
if (!$this->invoicePayments->contains($invoicePayment)) {
$this->invoicePayments->add($invoicePayment);
$invoicePayment->setInvoice($this);
}
return $this;
}
public function removeInvoicePayment(InvoicePayment $invoicePayment): static
{
if ($this->invoicePayments->removeElement($invoicePayment)) {
// set the owning side to null (unless already changed)
if ($invoicePayment->getInvoice() === $this) {
$invoicePayment->setInvoice(null);
}
}
return $this;
}
}