src/Entity/ProjectOrderInvoices.php line 19

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.  * @ORM\Entity(repositoryClass=ProjectOrderInvoicesRepository::class)
  12.  * @ORM\Table(name="project_order_invoices", uniqueConstraints={
  13.  *          @UniqueConstraint(name="order_unique_invoice_nr", columns={"invoice_nr", "project_order_id"})
  14.  *     })
  15.  */
  16. class ProjectOrderInvoices
  17. {
  18.     /**
  19.      * @ORM\Id
  20.      * @ORM\GeneratedValue
  21.      * @ORM\Column(type="integer")
  22.      * @Groups({
  23.      *      "project.details.orders",
  24.      *      "order.detail"
  25.      * })
  26.      */
  27.     private $id;
  28.     /**
  29.      * @ORM\ManyToOne(targetEntity=ProjectOrders::class, inversedBy="projectOrderInvoices")
  30.      * @ORM\JoinColumn(nullable=false, onDelete="CASCADE")
  31.      */
  32.     private $project_order;
  33.     /**
  34.      * @ORM\Column(type="float", nullable=true)
  35.      * @Groups({
  36.      *       "project.details.orders",
  37.      *       "order.detail"
  38.      *  })
  39.      */
  40.     private $price;
  41.     /**
  42.      * @ORM\Column(type="datetime_immutable", nullable=true)
  43.      * @Groups({
  44.      *        "project.details.orders",
  45.      *        "order.detail"
  46.      *   })
  47.      */
  48.     private $invoice_created_at;
  49.     /**
  50.      * @ORM\Column(type="datetime_immutable", nullable=true)
  51.      * @Groups({
  52.      *        "project.details.orders",
  53.      *        "order.detail"
  54.      *   })
  55.      */
  56.     private $invoice_sent_at;
  57.     /**
  58.      * @ORM\Column(type="integer", nullable=true)
  59.      * @Groups({
  60.      *        "project.details.orders",
  61.      *        "order.detail"
  62.      *   })
  63.      */
  64.     private $payment_due;
  65.     /**
  66.      * @ORM\Column(type="datetime_immutable", nullable=true)
  67.      * @Groups({
  68.      *        "project.details.orders",
  69.      *        "order.detail"
  70.      *   })
  71.      */
  72.     private $payment_due_at;
  73.     /**
  74.      * @ORM\OneToMany(targetEntity=ProjectOrderInvoicePositions::class, mappedBy="project_order_invoice", orphanRemoval=true, cascade={"persist", "remove"})
  75.      * @Groups({
  76.      *         "project.details.orders",
  77.      *         "order.detail"
  78.      *    })
  79.      */
  80.     private $project_order_invoice_positions;
  81.     /**
  82.      * @ORM\Column(type="datetime_immutable", nullable=true)
  83.      * @Groups({
  84.      *          "project.details.orders",
  85.      *          "order.detail"
  86.      *     })
  87.      */
  88.     private ?\DateTimeImmutable $completed_at null;
  89.     /**
  90.      * @ORM\Column(type="datetime_immutable", nullable=true)
  91.      * @ORM\JoinColumn(nullable=true)
  92.      */
  93.     private $created_at;
  94.     /**
  95.      * @ORM\Column(type="string", length=64)
  96.      * @ORM\JoinColumn(nullable=true)
  97.      * @Groups({
  98.      *           "project.details.orders",
  99.      *           "order.detail"
  100.      *      })
  101.      */
  102.     private $invoice_nr;
  103.     public function __construct()
  104.     {
  105.         $this->project_order_invoice_positions = new ArrayCollection();
  106.     }
  107.     public function getId(): ?int
  108.     {
  109.         return $this->id;
  110.     }
  111.     public function getProjectOrder(): ?ProjectOrders
  112.     {
  113.         return $this->project_order;
  114.     }
  115.     public function setProjectOrder(?ProjectOrders $project_order): self
  116.     {
  117.         $this->project_order $project_order;
  118.         return $this;
  119.     }
  120.     public function getPrice(): ?float
  121.     {
  122.         return $this->price;
  123.     }
  124.     public function setPrice(?float $price): self
  125.     {
  126.         $this->price $price;
  127.         return $this;
  128.     }
  129.     public function getInvoiceCreatedAt(): ?\DateTimeImmutable
  130.     {
  131.         return $this->invoice_created_at;
  132.     }
  133.     public function setInvoiceCreatedAt(?\DateTimeImmutable $invoice_created_at): self
  134.     {
  135.         $this->invoice_created_at $invoice_created_at;
  136.         return $this;
  137.     }
  138.     public function getInvoiceSentAt(): ?\DateTimeImmutable
  139.     {
  140.         return $this->invoice_sent_at;
  141.     }
  142.     public function setInvoiceSentAt(?\DateTimeImmutable $invoice_sent_at): self
  143.     {
  144.         $this->invoice_sent_at $invoice_sent_at;
  145.         return $this;
  146.     }
  147.     public function getPaymentDue(): ?int
  148.     {
  149.         return $this->payment_due;
  150.     }
  151.     public function setPaymentDue(?int $payment_due): self
  152.     {
  153.         $this->payment_due $payment_due;
  154.         return $this;
  155.     }
  156.     public function getPaymentDueAt(): ?\DateTimeImmutable
  157.     {
  158.         return $this->payment_due_at;
  159.     }
  160.     public function setPaymentDueAt(?\DateTimeImmutable $payment_due_at): self
  161.     {
  162.         $this->payment_due_at $payment_due_at;
  163.         return $this;
  164.     }
  165.     /**
  166.      * @return Collection<int, ProjectOrderInvoicePositions>
  167.      */
  168.     public function getProjectOrderInvoicePositions(): Collection
  169.     {
  170.         return $this->project_order_invoice_positions;
  171.     }
  172.     public function addProjectOrderInvoicePosition(ProjectOrderInvoicePositions $projectOrderInvoicePosition): self
  173.     {
  174.         if (!$this->project_order_invoice_positions->contains($projectOrderInvoicePosition)) {
  175.             $this->project_order_invoice_positions[] = $projectOrderInvoicePosition;
  176.             $projectOrderInvoicePosition->setProjectOrderInvoice($this);
  177.         }
  178.         return $this;
  179.     }
  180.     public function removeProjectOrderInvoicePosition(ProjectOrderInvoicePositions $projectOrderInvoicePosition): self
  181.     {
  182.         if ($this->project_order_invoice_positions->removeElement($projectOrderInvoicePosition)) {
  183.             // set the owning side to null (unless already changed)
  184.             if ($projectOrderInvoicePosition->getProjectOrderInvoice() === $this) {
  185.                 $projectOrderInvoicePosition->setProjectOrderInvoice(null);
  186.             }
  187.         }
  188.         return $this;
  189.     }
  190.     public function getCompletedAt(): ?\DateTimeImmutable
  191.     {
  192.         return $this->completed_at;
  193.     }
  194.     public function setCompletedAt(?\DateTimeImmutable $completed_at): self
  195.     {
  196.         $this->completed_at $completed_at;
  197.         return $this;
  198.     }
  199.     public function getCreatedAt(): ?\DateTimeImmutable
  200.     {
  201.         return $this->created_at;
  202.     }
  203.     public function setCreatedAt(\DateTimeImmutable $created_at): self
  204.     {
  205.         $this->created_at $created_at;
  206.         return $this;
  207.     }
  208.     public function getInvoiceNr(): ?string
  209.     {
  210.         return $this->invoice_nr;
  211.     }
  212.     public function setInvoiceNr(string $invoice_nr): self
  213.     {
  214.         $this->invoice_nr $invoice_nr;
  215.         return $this;
  216.     }
  217. }