src/Entity/Invoice.php line 14

Open in your IDE?
  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. #[ORM\Entity(repositoryClassInvoiceRepository::class)]
  9. #[ORM\HasLifecycleCallbacks]
  10. #[ORM\Table(name'invoice')]
  11. class Invoice extends BaseEntity
  12. {
  13.     #[ORM\Id]
  14.     #[ORM\GeneratedValue]
  15.     #[ORM\Column]
  16.     private ?int $id null;
  17.     #[ORM\Column(length255)]
  18.     private ?string $invoiceNumber null;
  19.     // totalAmount = Faturanın indirim ve vergi hesaplandıktan sonraki toplam miktarı
  20.     #[ORM\Column(typeTypes::DECIMALprecision10scale3)]
  21.     private ?string $totalAmount null;
  22.     #[ORM\Column(typeTypes::DATE_MUTABLE)]
  23.     private ?\DateTimeInterface $date null;
  24.     #[ORM\ManyToOne(inversedBy'invoices')]
  25.     private User $seller;
  26.     #[ORM\ManyToOne(inversedBy'invoices')]
  27.     private ?Warehouse $warehouse null;
  28.     #[ORM\OneToMany(mappedBy'invoice'targetEntityInvoiceItem::class, cascade: ['persist''remove'], orphanRemovaltrue)]
  29.     private Collection $invoiceItems;
  30.     #[ORM\Column]
  31.     private ?bool $isPublic null;
  32.     #[ORM\OneToMany(mappedBy'invoice'targetEntityPayment::class)]
  33.     private Collection $payments;
  34.     #[ORM\OneToMany(mappedBy'invoice'targetEntityStockTransaction::class)]
  35.     private $stockTransactions;
  36.     #[ORM\ManyToOne(targetEntityCustomer::class, inversedBy'invoices')]
  37.     #[ORM\JoinColumn(nullablefalse)]
  38.     private Customer $customer;
  39.     #[ORM\OneToOne(mappedBy'invoice'targetEntitySales::class)]
  40.     private ?Sales $proforma;
  41.     public function __construct()
  42.     {
  43.         $this->invoiceItems = new ArrayCollection();
  44.         $this->payments = new ArrayCollection();
  45.         $this->stockTransactions = new ArrayCollection();
  46.     }
  47.     public function getId(): ?int
  48.     {
  49.         return $this->id;
  50.     }
  51.     public function getInvoiceNumber(): ?string
  52.     {
  53.         return $this->invoiceNumber;
  54.     }
  55.     public function setInvoiceNumber(string $invoiceNumber): static
  56.     {
  57.         $this->invoiceNumber $invoiceNumber;
  58.         return $this;
  59.     }
  60.     public function getTotalAmount(): ?string
  61.     {
  62.         return $this->totalAmount;
  63.     }
  64.     public function setTotalAmount(string $totalAmount): static
  65.     {
  66.         $this->totalAmount $totalAmount;
  67.         return $this;
  68.     }
  69.     public function getDate(): ?\DateTimeInterface
  70.     {
  71.         return $this->date;
  72.     }
  73.     public function setDate(\DateTimeInterface $date): static
  74.     {
  75.         $this->date $date;
  76.         return $this;
  77.     }
  78.     public function getSeller(): User
  79.     {
  80.         return $this->seller;
  81.     }
  82.     public function setSeller(User $seller): void
  83.     {
  84.         $this->seller $seller;
  85.     }
  86.     public function getWarehouse(): ?Warehouse
  87.     {
  88.         return $this->warehouse;
  89.     }
  90.     public function setWarehouse(?Warehouse $warehouse): static
  91.     {
  92.         $this->warehouse $warehouse;
  93.         return $this;
  94.     }
  95.     /**
  96.      * @return Collection<int, InvoiceItem>
  97.      */
  98.     public function getInvoiceItems(): Collection
  99.     {
  100.         return $this->invoiceItems;
  101.     }
  102.     public function addInvoiceItem(InvoiceItem $invoiceItem): static
  103.     {
  104.         if (!$this->invoiceItems->contains($invoiceItem)) {
  105.             $this->invoiceItems->add($invoiceItem);
  106.             $invoiceItem->setInvoice($this);
  107.         }
  108.         return $this;
  109.     }
  110.     public function removeInvoiceItem(InvoiceItem $invoiceItem): static
  111.     {
  112.         if ($this->invoiceItems->removeElement($invoiceItem)) {
  113.             // set the owning side to null (unless already changed)
  114.             if ($invoiceItem->getInvoice() === $this) {
  115.                 $invoiceItem->setInvoice(null);
  116.             }
  117.         }
  118.         return $this;
  119.     }
  120.     public function isIsPublic(): ?bool
  121.     {
  122.         return $this->isPublic;
  123.     }
  124.     public function setIsPublic(bool $isPublic): static
  125.     {
  126.         $this->isPublic $isPublic;
  127.         return $this;
  128.     }
  129.     /**
  130.      * @return Collection<int, Payment>
  131.      */
  132.     public function getPayments(): Collection
  133.     {
  134.         return $this->payments;
  135.     }
  136.     public function addPayment(Payment $payment): static
  137.     {
  138.         if (!$this->payments->contains($payment)) {
  139.             $this->payments->add($payment);
  140.             $payment->setInvoice($this);
  141.         }
  142.         return $this;
  143.     }
  144.     public function removePayment(Payment $payment): static
  145.     {
  146.         if ($this->payments->removeElement($payment)) {
  147.             // set the owning side to null (unless already changed)
  148.             if ($payment->getInvoice() === $this) {
  149.                 $payment->setInvoice(null);
  150.             }
  151.         }
  152.         return $this;
  153.     }
  154.     /**
  155.      * @return mixed
  156.      */
  157.     public function getStockTransactions()
  158.     {
  159.         return $this->stockTransactions;
  160.     }
  161.     /**
  162.      * @param mixed $stockTransactions
  163.      */
  164.     public function setStockTransactions($stockTransactions): void
  165.     {
  166.         $this->stockTransactions $stockTransactions;
  167.     }
  168.     public function getProforma(): ?Sales
  169.     {
  170.         return $this->proforma;
  171.     }
  172.     public function setProforma(?Sales $proforma): void
  173.     {
  174.         $this->proforma $proforma;
  175.     }
  176.     public function getCustomer(): Customer
  177.     {
  178.         return $this->customer;
  179.     }
  180.     public function setCustomer(Customer $customer): void
  181.     {
  182.         $this->customer $customer;
  183.     }
  184. }