<?php
namespace App\Entity;
use App\Entity\Base\AbstractTimestampableEntity;
use App\Repository\TaskRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=TaskRepository::class)
* @ORM\HasLifecycleCallbacks()
*/
class Task extends AbstractTimestampableEntity
{
/**
* @ORM\Column(type="text", nullable=false)
*/
private $name;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $technicalDescription;
/**
* @ORM\Column(type="integer")
*/
private $scheduledHours;
/**
* @ORM\ManyToOne(targetEntity=User::class)
* @ORM\JoinColumn(nullable=false)
*/
private $taskOwner;
/**
* @ORM\ManyToOne(targetEntity=User::class, inversedBy="assignedTasks")
*/
private $assignedUser;
/**
* @ORM\Column(type="smallint")
*/
private $priotity;
/**
* @ORM\ManyToOne(targetEntity=TaskStatus::class)
* @ORM\JoinColumn(nullable=false)
*/
private $taskStatus;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $scheduleDate;
/**
* @ORM\OneToMany(targetEntity=TaskLog::class, mappedBy="task", orphanRemoval=true)
*/
private $taskLogs;
/**
* @ORM\ManyToOne(targetEntity=Project::class, inversedBy="tasks")
* @ORM\JoinColumn(nullable=false)
*/
private $project;
/**
* @ORM\Column(type="decimal", precision=11, scale=2, nullable=true)
*/
private $offerValue;
/**
* @ORM\Column(type="decimal", precision=11, scale=2, nullable=true)
*/
private $billableValue;
/**
* @ORM\ManyToOne(targetEntity=Currency::class, inversedBy="tasks")
* @ORM\JoinColumn(nullable=false)
*/
private $currency;
/**
* @ORM\ManyToOne(targetEntity=TaskType::class, inversedBy="tasks")
* @ORM\JoinColumn(nullable=false)
*/
private $taskType;
/**
* @ORM\OneToOne(targetEntity=OfferBody::class, cascade={"persist"})
*/
private $offerBody;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private $workedMinutes;
/**
* @ORM\ManyToOne(targetEntity=Tranche::class, inversedBy="tasks")
*/
private $tranche;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $notUsed;
/**
* @ORM\ManyToOne(targetEntity=Task::class, inversedBy="tasks")
*/
private $notUsedParent;
/**
* @ORM\OneToMany(targetEntity=Task::class, mappedBy="notUsedParent")
*/
private $tasks;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private $notUsedMinutes;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $finishedDate;
/**
* @ORM\Column(type="integer")
*/
private $orderTask;
public function __construct()
{
$this->taskLogs = new ArrayCollection();
$this->tasks = new ArrayCollection();
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
public function getTechnicalDescription(): ?string
{
return $this->technicalDescription;
}
public function setTechnicalDescription(?string $technicalDescription): self
{
$this->technicalDescription = $technicalDescription;
return $this;
}
public function getScheduledHours(): ?int
{
return $this->scheduledHours;
}
public function setScheduledHours(int $scheduledHours): self
{
$this->scheduledHours = $scheduledHours;
return $this;
}
public function getTaskOwner(): ?user
{
return $this->taskOwner;
}
public function setTaskOwner(?user $taskOwner): self
{
$this->taskOwner = $taskOwner;
return $this;
}
public function getAssignedUser(): ?user
{
return $this->assignedUser;
}
public function setAssignedUser(?user $assignedUser): self
{
$this->assignedUser = $assignedUser;
return $this;
}
public function getPriotity(): ?int
{
return $this->priotity;
}
public function setPriotity(int $priotity): self
{
$this->priotity = $priotity;
return $this;
}
public function getTaskStatus()
{
return $this->taskStatus;
}
public function setTaskStatus($taskStatus): void
{
$this->taskStatus = $taskStatus;
}
public function getScheduleDate(): ?\DateTimeInterface
{
return $this->scheduleDate;
}
public function setScheduleDate(?\DateTimeInterface $scheduleDate): self
{
$this->scheduleDate = $scheduleDate;
return $this;
}
/**
* @return Collection<int, TaskLog>
*/
public function getTaskLogs(): Collection
{
return $this->taskLogs;
}
public function addTaskLog(TaskLog $taskLog): self
{
if (!$this->taskLogs->contains($taskLog)) {
$this->taskLogs[] = $taskLog;
$taskLog->setTask($this);
}
return $this;
}
public function removeTaskLog(TaskLog $taskLog): self
{
if ($this->taskLogs->removeElement($taskLog)) {
// set the owning side to null (unless already changed)
if ($taskLog->getTask() === $this) {
$taskLog->setTask(null);
}
}
return $this;
}
public function getProject(): ?Project
{
return $this->project;
}
public function setProject(?Project $project): self
{
$this->project = $project;
return $this;
}
public function getOfferValue(): ?string
{
return $this->offerValue;
}
public function setOfferValue(?string $offerValue): self
{
$this->offerValue = $offerValue;
return $this;
}
public function getBillableValue(): ?string
{
return $this->billableValue;
}
public function setBillableValue(?string $billableValue): self
{
$this->billableValue = $billableValue;
return $this;
}
public function getCurrency(): ?Currency
{
return $this->currency;
}
public function setCurrency(?Currency $currency): self
{
$this->currency = $currency;
return $this;
}
public function getTaskType(): ?TaskType
{
return $this->taskType;
}
public function setTaskType(?TaskType $taskType): self
{
$this->taskType = $taskType;
return $this;
}
public function getOfferBody(): ?OfferBody
{
return $this->offerBody;
}
public function setOfferBody(?OfferBody $offerBody): self
{
$this->offerBody = $offerBody;
return $this;
}
public function getWorkedMinutes(): ?int
{
return $this->workedMinutes;
}
public function setWorkedMinutes(?int $workedMinutes): self
{
$this->workedMinutes = $workedMinutes;
return $this;
}
public function getTranche(): ?Tranche
{
return $this->tranche;
}
public function setTranche(?Tranche $tranche): self
{
$this->tranche = $tranche;
return $this;
}
public function isNotUsed(): ?bool
{
return $this->notUsed;
}
public function setNotUsed(?bool $notUsed): self
{
$this->notUsed = $notUsed;
return $this;
}
public function getNotUsedParent(): ?self
{
return $this->notUsedParent;
}
public function setNotUsedParent(?self $notUsedParent): self
{
$this->notUsedParent = $notUsedParent;
return $this;
}
/**
* @return Collection<int, self>
*/
public function getTasks(): Collection
{
return $this->tasks;
}
public function addTask(self $task): self
{
if (!$this->tasks->contains($task)) {
$this->tasks[] = $task;
$task->setNotUsedParent($this);
}
return $this;
}
public function removeTask(self $task): self
{
if ($this->tasks->removeElement($task)) {
// set the owning side to null (unless already changed)
if ($task->getNotUsedParent() === $this) {
$task->setNotUsedParent(null);
}
}
return $this;
}
public function getNotUsedMinutes(): ?int
{
return $this->notUsedMinutes;
}
public function setNotUsedMinutes(?int $notUsedMinutes): self
{
$this->notUsedMinutes = $notUsedMinutes;
return $this;
}
public function getFinishedDate(): ?\DateTimeInterface
{
return $this->finishedDate;
}
public function setFinishedDate(?\DateTimeInterface $finishedDate): self
{
$this->finishedDate = $finishedDate;
return $this;
}
public function getOrderTask(): ?int
{
return $this->orderTask;
}
public function setOrderTask(int $orderTask): self
{
$this->orderTask = $orderTask;
return $this;
}
}