src/Entity/ProjectOrderInvoices.php line 24

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ProjectOrderInvoicesRepository;
  4. use DateTimeImmutable;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\ORM\Mapping as ORM;
  8. use Symfony\Component\Serializer\Annotation\Groups;
  9. use Doctrine\ORM\Mapping\UniqueConstraint;
  10. /**
  11.  * @deprecated
  12.  * @see use ProjectOrderBillings
  13.  * TODO Replace this with name Billing -> ProjectOrderBillings
  14.  * @ORM\Entity(repositoryClass=ProjectOrderInvoicesRepository::class)
  15.  * @ORM\Table(name="project_order_invoices", uniqueConstraints={
  16.  *          @UniqueConstraint(name="order_unique_invoice_nr", columns={"invoice_nr", "project_order_id"})
  17.  *     }, options={"comment": "Deprecated Table use Invoices instead"})
  18.  *
  19.  */
  20. class ProjectOrderInvoices
  21. {
  22.     /**
  23.      * @ORM\Id
  24.      * @ORM\GeneratedValue
  25.      * @ORM\Column(type="integer")
  26.      * @Groups({
  27.      *     "project.details.orders",
  28.      *     "order.detail",
  29.      *
  30.      *     "project_order_invoice@core"
  31.      * })
  32.      */
  33.     private $id;
  34.     /**
  35.      * @ORM\ManyToOne(targetEntity=ProjectOrders::class, inversedBy="projectOrderInvoices")
  36.      * @ORM\JoinColumn(nullable=false, onDelete="CASCADE")
  37.      */
  38.     private $project_order;
  39.     /**
  40.      * @ORM\Column(type="float", nullable=true)
  41.      * @Groups({
  42.      *      "project.details.orders",
  43.      *      "order.detail",
  44.      *
  45.      *      "project_order_invoice@core"
  46.      *  })
  47.      */
  48.     private $price;
  49.     /**
  50.      * TODO Remove this props forever
  51.      * @deprecated
  52.      * @ORM\Column(type="datetime_immutable", nullable=true)
  53.      * @Groups({
  54.      *      "project.details.orders",
  55.      *      "order.detail",
  56.      *
  57.      *      "project_order_invoice@core"
  58.      *  })
  59.      */
  60.     private $invoice_created_at;
  61.     /**
  62.      * @ORM\Column(type="datetime_immutable", nullable=true)
  63.      * @Groups({
  64.      *      "project.details.orders",
  65.      *      "order.detail",
  66.      *
  67.      *      "project_order_invoice@core"
  68.      *  })
  69.      */
  70.     private $invoice_sent_at;
  71.     /**
  72.      * TODO Remove this props forever
  73.      * @deprecated
  74.      *
  75.      * @ORM\Column(type="integer", nullable=true)
  76.      * @Groups({
  77.      *      "project.details.orders",
  78.      *      "order.detail",
  79.      *
  80.      *      "project_order_invoice@core"
  81.      *  })
  82.      */
  83.     private $payment_due;
  84.     /**
  85.      * @ORM\Column(type="datetime_immutable", nullable=true)
  86.      * @Groups({
  87.      *      "project.details.orders",
  88.      *      "order.detail",
  89.      *
  90.      *      "project_order_invoice@core"
  91.      *  })
  92.      */
  93.     private $payment_due_at;
  94.     /**
  95.      * TODO create Repair & Move all positions amount to Price prop
  96.      * TODO Remove this prop
  97.      * @deprecated
  98.      * @see use direct price prop intead of position's
  99.      * @ORM\OneToMany(targetEntity=ProjectOrderInvoicePositions::class, mappedBy="project_order_invoice", orphanRemoval=true, cascade={"persist", "remove"})
  100.      * @Groups({
  101.      *      "project.details.orders",
  102.      *      "order.detail",
  103.      *
  104.      *      "project_order_invoice@positions"
  105.      *  })
  106.      */
  107.     private $project_order_invoice_positions;
  108.     /**
  109.      * /TODO Remove this prop
  110.      * @deprecated
  111.      * @see completed not more useable  follow this operation over Invoice/invoicePosition/payed_at
  112.      * @ORM\Column(type="datetime_immutable", nullable=true)
  113.      * @Groups({
  114.      *     "project.details.orders",
  115.      *     "order.detail",
  116.      *
  117.      *
  118.      *     "project_order_invoice@core"
  119.      * })
  120.      */
  121.     private ?\DateTimeImmutable $completed_at null;
  122.     /**
  123.      * @ORM\Column(type="datetime_immutable", nullable=true)
  124.      * @ORM\JoinColumn(nullable=true)
  125.      * @Groups({
  126.      *       "project.details.orders",
  127.      *       "order.detail",
  128.      *
  129.      *       "project_order_invoice@core"
  130.      *   })
  131.      */
  132.     private $created_at;
  133.     /**
  134.      * TODO Replace this name with billing_nr
  135.      * @ORM\Column(type="string", length=64, options={"comment": "Bu bir Kesilmis fatura numarasidir, Bir odemeye ait fatumra numarasi degil, Odeme Faruta numarasi Invoices/INvoicePositions table da"})
  136.      * @ORM\JoinColumn(nullable=true)
  137.      * @Groups({
  138.      *       "project.details.orders",
  139.      *       "order.detail",
  140.      *
  141.      *       "project_order_invoice@core"
  142.      *   })
  143.      */
  144.     private $invoice_nr;
  145.     /**
  146.      * Bu Odeme yapilan Document positionlari
  147.      * @ORM\OneToMany(targetEntity=InvoicePositions::class, mappedBy="order_invoice")
  148.      * @Groups({
  149.      *     "project_order_invoice@invoice_positions"
  150.      * })
  151.      */
  152.     private $invoice_positions;
  153.     public function __construct()
  154.     {
  155.         $this->project_order_invoice_positions = new ArrayCollection();
  156.         $this->invoice_positions = new ArrayCollection();
  157.     }
  158.     public function getId(): ?int
  159.     {
  160.         return $this->id;
  161.     }
  162.     public function getProjectOrder(): ?ProjectOrders
  163.     {
  164.         return $this->project_order;
  165.     }
  166.     public function setProjectOrder(?ProjectOrders $project_order): self
  167.     {
  168.         $this->project_order $project_order;
  169.         return $this;
  170.     }
  171.     public function getPrice(): ?float
  172.     {
  173.         return $this->price;
  174.     }
  175.     public function setPrice(?float $price): self
  176.     {
  177.         $this->price $price;
  178.         return $this;
  179.     }
  180.     public function getInvoiceCreatedAt(): ?\DateTimeImmutable
  181.     {
  182.         return $this->invoice_created_at;
  183.     }
  184.     public function setInvoiceCreatedAt(?\DateTimeImmutable $invoice_created_at): self
  185.     {
  186.         $this->invoice_created_at $invoice_created_at;
  187.         return $this;
  188.     }
  189.     public function getInvoiceSentAt(): ?\DateTimeImmutable
  190.     {
  191.         return $this->invoice_sent_at;
  192.     }
  193.     public function setInvoiceSentAt(?\DateTimeImmutable $invoice_sent_at): self
  194.     {
  195.         $this->invoice_sent_at $invoice_sent_at;
  196.         return $this;
  197.     }
  198.     public function getPaymentDue(): ?int
  199.     {
  200.         return $this->payment_due;
  201.     }
  202.     public function setPaymentDue(?int $payment_due): self
  203.     {
  204.         $this->payment_due $payment_due;
  205.         return $this;
  206.     }
  207.     public function getPaymentDueAt(): ?\DateTimeImmutable
  208.     {
  209.         return $this->payment_due_at;
  210.     }
  211.     public function setPaymentDueAt(?\DateTimeImmutable $payment_due_at): self
  212.     {
  213.         $this->payment_due_at $payment_due_at;
  214.         return $this;
  215.     }
  216.     /**
  217.      * @see use direct price prop intead of position's
  218.      * @deprecated
  219.      * @return Collection<int, ProjectOrderInvoicePositions>
  220.      */
  221.     public function getProjectOrderInvoicePositions(): Collection
  222.     {
  223.         return $this->project_order_invoice_positions;
  224.     }
  225.     /**
  226.      * TODO Remove this prop
  227.      * @see use direct price prop intead of position's
  228.      * @deprecated
  229.      */
  230.     public function addProjectOrderInvoicePosition(ProjectOrderInvoicePositions $projectOrderInvoicePosition): self
  231.     {
  232.         if (!$this->project_order_invoice_positions->contains($projectOrderInvoicePosition)) {
  233.             $this->project_order_invoice_positions[] = $projectOrderInvoicePosition;
  234.             $projectOrderInvoicePosition->setProjectOrderInvoice($this);
  235.         }
  236.         return $this;
  237.     }
  238.     /**
  239.      * TODO Remove this prop
  240.      * @see use direct price prop intead of position's
  241.      * @deprecated
  242.      */
  243.     public function removeProjectOrderInvoicePosition(ProjectOrderInvoicePositions $projectOrderInvoicePosition): self
  244.     {
  245.         if ($this->project_order_invoice_positions->removeElement($projectOrderInvoicePosition)) {
  246.             // set the owning side to null (unless already changed)
  247.             if ($projectOrderInvoicePosition->getProjectOrderInvoice() === $this) {
  248.                 $projectOrderInvoicePosition->setProjectOrderInvoice(null);
  249.             }
  250.         }
  251.         return $this;
  252.     }
  253.     /**
  254.      * TODO Remove this prop
  255.      * @deprecated
  256.      * @see completed not more useable  follow this operation over Invoice/invoicePosition/payed_at
  257.     */
  258.     public function getCompletedAt(): ?\DateTimeImmutable
  259.     {
  260.         return $this->completed_at;
  261.     }
  262.     /**
  263.      * TODO Remove this prop
  264.      * @deprecated
  265.      * @see completed not more useable  follow this operation over Invoice/invoicePosition/payed_at
  266.      */
  267.     public function setCompletedAt(?\DateTimeImmutable $completed_at): self
  268.     {
  269.         $this->completed_at $completed_at;
  270.         return $this;
  271.     }
  272.     public function getCreatedAt(): ?\DateTimeImmutable
  273.     {
  274.         return $this->created_at;
  275.     }
  276.     public function setCreatedAt(\DateTimeImmutable $created_at): self
  277.     {
  278.         $this->created_at $created_at;
  279.         return $this;
  280.     }
  281.     public function getInvoiceNr(): ?string
  282.     {
  283.         return $this->invoice_nr;
  284.     }
  285.     public function setInvoiceNr(string $invoice_nr): self
  286.     {
  287.         $this->invoice_nr $invoice_nr;
  288.         return $this;
  289.     }
  290.     /**
  291.      * @return Collection<int, InvoicePositions>
  292.      */
  293.     public function getInvoicePositions(): Collection
  294.     {
  295.         return $this->invoice_positions;
  296.     }
  297.     public function addInvoicePosition(InvoicePositions $invoicePosition): self
  298.     {
  299.         if (!$this->invoice_positions->contains($invoicePosition)) {
  300.             $this->invoice_positions[] = $invoicePosition;
  301.             $invoicePosition->setOrderInvoice($this);
  302.         }
  303.         return $this;
  304.     }
  305.     public function removeInvoicePosition(InvoicePositions $invoicePosition): self
  306.     {
  307.         if ($this->invoice_positions->removeElement($invoicePosition)) {
  308.             // set the owning side to null (unless already changed)
  309.             if ($invoicePosition->getOrderInvoice() === $this) {
  310.                 $invoicePosition->setOrderInvoice(null);
  311.             }
  312.         }
  313.         return $this;
  314.     }
  315. }