<?php
namespace App\Entity;
use App\Repository\ProjectOrderUndertakingsRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
use Symfony\Component\Serializer\Annotation\Groups;
use Doctrine\ORM\Mapping\UniqueConstraint;
/**
* @deprecated
* TODO Remove this Entity forever
* @see use ProjectOrderBillings
* @ORM\Entity(repositoryClass=ProjectOrderUndertakingsRepository::class)
* @ORM\Table(name="project_order_undertakings", uniqueConstraints={
* @UniqueConstraint(name="order_unique_invoice_nr", columns={"position_nr", "project_order_id"})
* })
* @UniqueEntity(
* fields={"project_order", "position_nr"},
* message="Employee already registered|Undertaking with combination (%s %s) is already registered"
* )
*/
class ProjectOrderUndertakings
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
* @Groups({
* "project.order.undertaking.base",
* "project.details.orders",
* "order.detail",
* "vouchers.assigned.order.undertakings",
*
* "project_order_undertaking@core"
* })
*/
private $id;
/**
* @ORM\ManyToOne(targetEntity=ProjectOrders::class, inversedBy="project_order_undertakings")
* @ORM\JoinColumn(nullable=true, onDelete="CASCADE")
*/
private $project_order;
/**
* @ORM\Column(type="datetime_immutable", nullable=true)
* @Groups({
* "project.order.undertaking.base",
* "project.details.orders",
* "order.detail",
* "vouchers.assigned.order.undertakings",
*
* "project_order_undertaking@core"
* })
*/
private $created_at;
/**
* @ORM\Column(type="datetime_immutable", nullable=true)
* @Groups({
* "project.order.undertaking.base",
* "project.details.orders",
* "order.detail",
* "vouchers.assigned.order.undertakings",
*
* "project_order_undertaking@core"
* })
*/
private $sent_at;
/**
* @ORM\Column(type="datetime_immutable", nullable=true)
* @Groups({
* "project.order.undertaking.base",
* "project.details.orders",
* "order.detail",
* "vouchers.assigned.order.undertakings",
*
* "project_order_undertaking@core"
* })
*/
private $completed_at;
/**
* @ORM\Column(type="string", length=64, nullable=false, options={"comment":"Client undertaking via (Gutschrift) Position number"})
* @Groups({
* "project.order.undertaking.base",
* "project.details.orders",
* "order.detail",
* "vouchers.assigned.order.undertakings",
*
* "project_order_undertaking@core"
* })
*/
private $position_nr;
/**
* @ORM\ManyToOne(targetEntity=Vouchers::class, inversedBy="project_order_undertakings")
* @ORM\JoinColumn(nullable=true)
* @Groups({
* "project.order.undertaking.base",
* "project.details.orders",
* "order.detail",
* "vouchers.assigned.order.undertakings",
*
* "project_order_undertaking@vouchers"
* })
*/
private $voucher;
/**
* @ORM\Column(type="float", precision=2, scale=2, nullable=true)
* @ORM\JoinColumn(nullable=true)
* @Groups({
* "project.order.undertaking.base",
* "project.details.orders",
* "order.detail",
* "vouchers.assigned.order.undertakings",
*
* "project_order_undertaking@core"
* })
*/
private $price;
/**
* @ORM\OneToMany(targetEntity=InvoicePositions::class, mappedBy="order_undertaking")
*/
private $invoice_positions;
public function __construct()
{
$this->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 getCreatedAt(): ?\DateTimeImmutable
{
return $this->created_at;
}
public function setCreatedAt(?\DateTimeImmutable $created_at): self
{
$this->created_at = $created_at;
return $this;
}
public function getSentAt(): ?\DateTimeImmutable
{
return $this->sent_at;
}
public function setSentAt(?\DateTimeImmutable $sent_at): self
{
$this->sent_at = $sent_at;
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 getPositionNr(): ?string
{
return $this->position_nr;
}
public function setPositionNr(?string $position_nr): self
{
$this->position_nr = $position_nr;
return $this;
}
public function getVoucher(): ?Vouchers
{
return $this->voucher;
}
public function setVoucher(?Vouchers $voucher): self
{
$this->voucher = $voucher;
return $this;
}
public function getPrice(): ?float
{
return $this->price;
}
public function setPrice(?float $price): self
{
$this->price = $price;
return $this;
}
/**
* @return Collection<int, InvoicePositions>
*/
public function getInvoicePositions(): Collection
{
return $this->invoice_positions;
}
public function addInvoicePosition(InvoicePositions $invoicePosition): self
{
if (!$this->invoice_positions->contains($invoicePosition)) {
$this->invoice_positions[] = $invoicePosition;
$invoicePosition->setOrderUndertaking($this);
}
return $this;
}
public function removeInvoicePosition(InvoicePositions $invoicePosition): self
{
if ($this->invoice_positions->removeElement($invoicePosition)) {
// set the owning side to null (unless already changed)
if ($invoicePosition->getOrderUndertaking() === $this) {
$invoicePosition->setOrderUndertaking(null);
}
}
return $this;
}
}