<?php
namespace App\Entity;
use App\Repository\TrancheRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=TrancheRepository::class)
*/
class Tranche
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=500)
*/
private $name;
/**
* @ORM\ManyToOne(targetEntity=Contract::class, inversedBy="tranches")
* @ORM\JoinColumn(nullable=false)
*/
private $contract;
/**
* @ORM\Column(type="date", nullable=true)
*/
private $paymentDate;
/**
* @ORM\Column(type="date")
*/
private $executionDate;
/**
* @ORM\OneToMany(targetEntity=Task::class, mappedBy="tranche")
* @ORM\OrderBy({"orderTask": "ASC"})
*/
private $tasks;
/**
* @ORM\Column(type="decimal", precision=10, scale=2)
*/
private $billableValue;
/**
* @ORM\OneToMany(targetEntity=FacturaBody::class, mappedBy="tranche")
*/
private $facturaBodies;
/**
* @ORM\Column(type="string", length=500, nullable=true)
*/
private $facturaRowTxt;
/**
* @ORM\ManyToOne(targetEntity=Unit::class)
* @ORM\JoinColumn(nullable=false)
*/
private $unit;
public function __construct()
{
$this->tasks = new ArrayCollection();
$this->facturaBodies = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
public function getContract(): ?Contract
{
return $this->contract;
}
public function setContract(?Contract $contract): self
{
$this->contract = $contract;
return $this;
}
public function getPaymentDate(): ?\DateTimeInterface
{
return $this->paymentDate;
}
public function setPaymentDate(?\DateTimeInterface $paymentDate): self
{
$this->paymentDate = $paymentDate;
return $this;
}
public function getExecutionDate(): ?\DateTimeInterface
{
return $this->executionDate;
}
public function setExecutionDate(\DateTimeInterface $executionDate): self
{
$this->executionDate = $executionDate;
return $this;
}
/**
* @return Collection<int, Task>
*/
public function getTasks(): Collection
{
return $this->tasks;
}
public function addTask(Task $task): self
{
if (!$this->tasks->contains($task)) {
$this->tasks[] = $task;
$task->setTranche($this);
}
return $this;
}
public function removeTask(Task $task): self
{
if ($this->tasks->removeElement($task)) {
// set the owning side to null (unless already changed)
if ($task->getTranche() === $this) {
$task->setTranche(null);
}
}
return $this;
}
public function getBillableValue(): ?string
{
return $this->billableValue;
}
public function setBillableValue(string $billableValue): self
{
$this->billableValue = $billableValue;
return $this;
}
/**
* @return Collection<int, FacturaBody>
*/
public function getFacturaBodies(): Collection
{
return $this->facturaBodies;
}
public function addFacturaBody(FacturaBody $facturaBody): self
{
if (!$this->facturaBodies->contains($facturaBody)) {
$this->facturaBodies[] = $facturaBody;
$facturaBody->setTranche($this);
}
return $this;
}
public function removeFacturaBody(FacturaBody $facturaBody): self
{
if ($this->facturaBodies->removeElement($facturaBody)) {
// set the owning side to null (unless already changed)
if ($facturaBody->getTranche() === $this) {
$facturaBody->setTranche(null);
}
}
return $this;
}
public function getFacturaRowTxt(): ?string
{
return $this->facturaRowTxt;
}
public function setFacturaRowTxt(?string $facturaRowTxt): self
{
$this->facturaRowTxt = $facturaRowTxt;
return $this;
}
public function getUnit(): ?Unit
{
return $this->unit;
}
public function setUnit(?Unit $unit): self
{
$this->unit = $unit;
return $this;
}
}