src/Entity/Invoice.php line 14

  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\InvoiceRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\DBAL\Types\Types;
  7. use Doctrine\ORM\Mapping as ORM;
  8. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  9. #[ORM\Entity(repositoryClassInvoiceRepository::class)]
  10. #[UniqueEntity('number')]
  11. class Invoice
  12. {
  13.     #[ORM\Id]
  14.     #[ORM\GeneratedValue]
  15.     #[ORM\Column]
  16.     private ?int $id null;
  17.     #[ORM\ManyToOne(inversedBy'invoices')]
  18.     private ?User $user null;
  19.     #[ORM\Column(typeTypes::DATETIME_MUTABLEnullabletrue)]
  20.     private ?\DateTimeInterface $created null;
  21.     #[ORM\Column(nullabletrue)]
  22.     private ?int $year null;
  23.     #[ORM\Column(typeTypes::SMALLINTnullabletrue)]
  24.     private ?int $month null;
  25.     #[ORM\Column(length255uniquetruenullabletrue)]
  26.     private ?string $number null;
  27.     #[ORM\Column(length255nullabletrue)]
  28.     private ?string $formattedNumber null;
  29.     #[ORM\Column(length255nullabletrue)]
  30.     private ?string $folder_path null;
  31.     #[ORM\Column(length20nullabletrue)]
  32.     private ?string $subscriptionType null;
  33.     #[ORM\Column(typeTypes::DATE_MUTABLEnullabletrue)]
  34.     private ?\DateTimeInterface $billingDate null;
  35.     #[ORM\Column(nullabletrue)]
  36.     private ?bool $sentToEmail null;
  37.     #[ORM\Column(nullabletrue)]
  38.     private ?float $amount null;
  39.     #[ORM\Column(length50nullabletrue)]
  40.     private ?string $orders null;
  41.     #[ORM\OneToMany(mappedBy'invoice'targetEntityInvoiceItem::class)]
  42.     private Collection $invoiceItems;
  43.     #[ORM\Column(length255nullabletrue)]
  44.     private ?string $contractNumber null;
  45.     #[ORM\OneToMany(mappedBy'invoice'targetEntityInvoicePayment::class)]
  46.     private Collection $invoicePayments;
  47.     public function __construct()
  48.     {
  49.         $this->invoiceItems = new ArrayCollection();
  50.         $this->invoicePayments = new ArrayCollection();
  51.     }
  52.     public function getId(): ?int
  53.     {
  54.         return $this->id;
  55.     }
  56.     public function getUser(): ?User
  57.     {
  58.         return $this->user;
  59.     }
  60.     public function setUser(?User $user): self
  61.     {
  62.         $this->user $user;
  63.         return $this;
  64.     }
  65.     public function getCreated(): ?\DateTimeInterface
  66.     {
  67.         return $this->created;
  68.     }
  69.     public function setCreated(?\DateTimeInterface $created): self
  70.     {
  71.         $this->created $created;
  72.         return $this;
  73.     }
  74.     public function getYear(): ?int
  75.     {
  76.         return $this->year;
  77.     }
  78.     public function setYear(?int $year): self
  79.     {
  80.         $this->year $year;
  81.         return $this;
  82.     }
  83.     public function getMonth(): ?int
  84.     {
  85.         return $this->month;
  86.     }
  87.     public function setMonth(?int $month): self
  88.     {
  89.         $this->month $month;
  90.         return $this;
  91.     }
  92.     public function getNumber(): ?string
  93.     {
  94.         return $this->number;
  95.     }
  96.     public function setNumber(?string $number): self
  97.     {
  98.         $this->number $number;
  99.         return $this;
  100.     }
  101.     public function getFormattedNumber(): ?string
  102.     {
  103.         return $this->formattedNumber;
  104.     }
  105.     public function setFormattedNumber(?string $formattedNumber): self
  106.     {
  107.         $this->formattedNumber $formattedNumber;
  108.         return $this;
  109.     }
  110.     public function getFolderPath(): ?string
  111.     {
  112.         return $this->folder_path;
  113.     }
  114.     public function setFolderPath(?string $folder_path): self
  115.     {
  116.         $this->folder_path $folder_path;
  117.         return $this;
  118.     }
  119.     public function getSubscriptionType(): ?string
  120.     {
  121.         return $this->subscriptionType;
  122.     }
  123.     public function setSubscriptionType(?string $subscriptionType): self
  124.     {
  125.         $this->subscriptionType $subscriptionType;
  126.         return $this;
  127.     }
  128.     public function getBillingDate(): ?\DateTimeInterface
  129.     {
  130.         return $this->billingDate;
  131.     }
  132.     public function setBillingDate(?\DateTimeInterface $billingDate): self
  133.     {
  134.         $this->billingDate $billingDate;
  135.         return $this;
  136.     }
  137.     public function isSentToEmail(): ?bool
  138.     {
  139.         return $this->sentToEmail;
  140.     }
  141.     public function setSentToEmail(?bool $sentToEmail): static
  142.     {
  143.         $this->sentToEmail $sentToEmail;
  144.         return $this;
  145.     }
  146.     public function getAmount(): ?float
  147.     {
  148.         return $this->amount;
  149.     }
  150.     public function setAmount(?float $amount): static
  151.     {
  152.         $this->amount $amount;
  153.         return $this;
  154.     }
  155.     public function getOrders(): ?string
  156.     {
  157.         return $this->orders;
  158.     }
  159.     public function setOrders(?string $orders): static
  160.     {
  161.         $this->orders $orders;
  162.         return $this;
  163.     }
  164.     /**
  165.      * @return Collection<int, InvoiceItem>
  166.      */
  167.     public function getInvoiceItems(): Collection
  168.     {
  169.         return $this->invoiceItems;
  170.     }
  171.     public function addInvoiceItem(InvoiceItem $invoiceItem): static
  172.     {
  173.         if (!$this->invoiceItems->contains($invoiceItem)) {
  174.             $this->invoiceItems->add($invoiceItem);
  175.             $invoiceItem->setInvoice($this);
  176.         }
  177.         return $this;
  178.     }
  179.     public function removeInvoiceItem(InvoiceItem $invoiceItem): static
  180.     {
  181.         if ($this->invoiceItems->removeElement($invoiceItem)) {
  182.             // set the owning side to null (unless already changed)
  183.             if ($invoiceItem->getInvoice() === $this) {
  184.                 $invoiceItem->setInvoice(null);
  185.             }
  186.         }
  187.         return $this;
  188.     }
  189.     public function getContractNumber(): ?string
  190.     {
  191.         return $this->contractNumber;
  192.     }
  193.     public function setContractNumber(?string $contractNumber): static
  194.     {
  195.         $this->contractNumber $contractNumber;
  196.         return $this;
  197.     }
  198.     /**
  199.      * @return Collection<int, InvoicePayment>
  200.      */
  201.     public function getInvoicePayments(): Collection
  202.     {
  203.         return $this->invoicePayments;
  204.     }
  205.     public function addInvoicePayment(InvoicePayment $invoicePayment): static
  206.     {
  207.         if (!$this->invoicePayments->contains($invoicePayment)) {
  208.             $this->invoicePayments->add($invoicePayment);
  209.             $invoicePayment->setInvoice($this);
  210.         }
  211.         return $this;
  212.     }
  213.     public function removeInvoicePayment(InvoicePayment $invoicePayment): static
  214.     {
  215.         if ($this->invoicePayments->removeElement($invoicePayment)) {
  216.             // set the owning side to null (unless already changed)
  217.             if ($invoicePayment->getInvoice() === $this) {
  218.                 $invoicePayment->setInvoice(null);
  219.             }
  220.         }
  221.         return $this;
  222.     }
  223. }