<?php
namespace App\Entity;
use App\Repository\ProjectOrderInvoicesRepository;
use DateTimeImmutable;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation\Groups;
use Doctrine\ORM\Mapping\UniqueConstraint;
/**
* @ORM\Entity(repositoryClass=ProjectOrderInvoicesRepository::class)
* @ORM\Table(name="project_order_invoices", uniqueConstraints={
* @UniqueConstraint(name="order_unique_invoice_nr", columns={"invoice_nr", "project_order_id"})
* })
*/
class ProjectOrderInvoices
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
* @Groups({
* "project.details.orders",
* "order.detail"
* })
*/
private $id;
/**
* @ORM\ManyToOne(targetEntity=ProjectOrders::class, inversedBy="projectOrderInvoices")
* @ORM\JoinColumn(nullable=false, onDelete="CASCADE")
*/
private $project_order;
/**
* @ORM\Column(type="float", nullable=true)
* @Groups({
* "project.details.orders",
* "order.detail"
* })
*/
private $price;
/**
* @ORM\Column(type="datetime_immutable", nullable=true)
* @Groups({
* "project.details.orders",
* "order.detail"
* })
*/
private $invoice_created_at;
/**
* @ORM\Column(type="datetime_immutable", nullable=true)
* @Groups({
* "project.details.orders",
* "order.detail"
* })
*/
private $invoice_sent_at;
/**
* @ORM\Column(type="integer", nullable=true)
* @Groups({
* "project.details.orders",
* "order.detail"
* })
*/
private $payment_due;
/**
* @ORM\Column(type="datetime_immutable", nullable=true)
* @Groups({
* "project.details.orders",
* "order.detail"
* })
*/
private $payment_due_at;
/**
* @ORM\OneToMany(targetEntity=ProjectOrderInvoicePositions::class, mappedBy="project_order_invoice", orphanRemoval=true, cascade={"persist", "remove"})
* @Groups({
* "project.details.orders",
* "order.detail"
* })
*/
private $project_order_invoice_positions;
/**
* @ORM\Column(type="datetime_immutable", nullable=true)
* @Groups({
* "project.details.orders",
* "order.detail"
* })
*/
private ?\DateTimeImmutable $completed_at = null;
/**
* @ORM\Column(type="datetime_immutable", nullable=true)
* @ORM\JoinColumn(nullable=true)
*/
private $created_at;
/**
* @ORM\Column(type="string", length=64)
* @ORM\JoinColumn(nullable=true)
* @Groups({
* "project.details.orders",
* "order.detail"
* })
*/
private $invoice_nr;
public function __construct()
{
$this->project_order_invoice_positions = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getProjectOrder(): ?ProjectOrders
{
return $this->project_order;
}
public function setProjectOrder(?ProjectOrders $project_order): self
{
$this->project_order = $project_order;
return $this;
}
public function getPrice(): ?float
{
return $this->price;
}
public function setPrice(?float $price): self
{
$this->price = $price;
return $this;
}
public function getInvoiceCreatedAt(): ?\DateTimeImmutable
{
return $this->invoice_created_at;
}
public function setInvoiceCreatedAt(?\DateTimeImmutable $invoice_created_at): self
{
$this->invoice_created_at = $invoice_created_at;
return $this;
}
public function getInvoiceSentAt(): ?\DateTimeImmutable
{
return $this->invoice_sent_at;
}
public function setInvoiceSentAt(?\DateTimeImmutable $invoice_sent_at): self
{
$this->invoice_sent_at = $invoice_sent_at;
return $this;
}
public function getPaymentDue(): ?int
{
return $this->payment_due;
}
public function setPaymentDue(?int $payment_due): self
{
$this->payment_due = $payment_due;
return $this;
}
public function getPaymentDueAt(): ?\DateTimeImmutable
{
return $this->payment_due_at;
}
public function setPaymentDueAt(?\DateTimeImmutable $payment_due_at): self
{
$this->payment_due_at = $payment_due_at;
return $this;
}
/**
* @return Collection<int, ProjectOrderInvoicePositions>
*/
public function getProjectOrderInvoicePositions(): Collection
{
return $this->project_order_invoice_positions;
}
public function addProjectOrderInvoicePosition(ProjectOrderInvoicePositions $projectOrderInvoicePosition): self
{
if (!$this->project_order_invoice_positions->contains($projectOrderInvoicePosition)) {
$this->project_order_invoice_positions[] = $projectOrderInvoicePosition;
$projectOrderInvoicePosition->setProjectOrderInvoice($this);
}
return $this;
}
public function removeProjectOrderInvoicePosition(ProjectOrderInvoicePositions $projectOrderInvoicePosition): self
{
if ($this->project_order_invoice_positions->removeElement($projectOrderInvoicePosition)) {
// set the owning side to null (unless already changed)
if ($projectOrderInvoicePosition->getProjectOrderInvoice() === $this) {
$projectOrderInvoicePosition->setProjectOrderInvoice(null);
}
}
return $this;
}
public function getCompletedAt(): ?\DateTimeImmutable
{
return $this->completed_at;
}
public function setCompletedAt(?\DateTimeImmutable $completed_at): self
{
$this->completed_at = $completed_at;
return $this;
}
public function getCreatedAt(): ?\DateTimeImmutable
{
return $this->created_at;
}
public function setCreatedAt(\DateTimeImmutable $created_at): self
{
$this->created_at = $created_at;
return $this;
}
public function getInvoiceNr(): ?string
{
return $this->invoice_nr;
}
public function setInvoiceNr(string $invoice_nr): self
{
$this->invoice_nr = $invoice_nr;
return $this;
}
}