src/Admin/Modules/Contract/Entity/ContractTasksDepartmentTask.php line 15

  1. <?php
  2. namespace App\Admin\Modules\Contract\Entity;
  3. use App\Modules\User\Entity\User;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\DBAL\Types\Types;
  7. use Doctrine\ORM\Mapping as ORM;
  8. /**
  9.  * @ORM\Table(name="contract_tasks_department_task", indexes={@ORM\Index(columns={"position"})})
  10.  * @ORM\Entity
  11.  */
  12. class ContractTasksDepartmentTask
  13. {
  14.     /**
  15.      * @var int
  16.      *
  17.      * @ORM\Column(type="bigint", options={"unsigned"=true}))
  18.      * @ORM\Id
  19.      * @ORM\GeneratedValue(strategy="AUTO")
  20.      */
  21.     protected $id;
  22.     
  23.     /**
  24.      * @var \App\Admin\Modules\Contract\Entity\ContractTasksDepartment
  25.      *
  26.      * @ORM\ManyToOne(targetEntity="App\Admin\Modules\Contract\Entity\ContractTasksDepartment", inversedBy="tasks")
  27.      * @ORM\JoinColumns({
  28.      *   @ORM\JoinColumn(name="id_contract_tasks_department", referencedColumnName="id", nullable=false, onDelete="CASCADE")
  29.      * })
  30.      */
  31.     private $department;
  32.     
  33.     /**
  34.      * @var string
  35.      *
  36.      * @ORM\Column(name="name", type="string", length=255, nullable=false, options={"collation"="utf8_unicode_ci"})
  37.      */
  38.     private $name;
  39.     
  40.     /**
  41.      * @var int
  42.      *
  43.      * @ORM\Column(name="deadline_days", type="integer", nullable=false)
  44.      */
  45.     private $deadlineDays;    
  46.     
  47.     /**
  48.      * @var bool
  49.      *
  50.      * @ORM\Column(name="is_done", type="boolean", nullable=false)
  51.      */
  52.     private $isDone;
  53.     
  54.     /**
  55.      * @var \DateTime
  56.      *
  57.      * @ORM\Column(name="finished_at", type="datetime", nullable=true)
  58.      */
  59.     private $finishedAt;    
  60.     /**
  61.      * @var \App\Modules\User\Entity\User
  62.      *
  63.      * @ORM\ManyToOne(targetEntity="App\Modules\User\Entity\User")
  64.      * @ORM\JoinColumns({
  65.      *   @ORM\JoinColumn(name="id_finished_by_user", referencedColumnName="id", nullable=true, onDelete="SET NULL")
  66.      * })
  67.      */
  68.     private $finishedBy
  69.     /**
  70.      * @var int
  71.      *
  72.      * @ORM\Column(name="position", type="integer", nullable=false)
  73.      */
  74.     private $position;
  75.     
  76.     /**
  77.      * @var \App\Admin\Modules\Contract\Entity\ContractTasksDepartmentTaskNote
  78.      *
  79.      * @ORM\OneToMany(targetEntity="App\Admin\Modules\Contract\Entity\ContractTasksDepartmentTaskNote", mappedBy="task", cascade={"persist"}, orphanRemoval=true)
  80.      * @ORM\OrderBy({"addedAt"="DESC"})
  81.      */
  82.     private $notes;    
  83.     public function __construct()
  84.     {
  85.         $this->isDone false;
  86.         $this->notes = new ArrayCollection();
  87.     }
  88.     
  89.     public function getId(): ?string
  90.     {
  91.         return $this->id;
  92.     }
  93.     public function getName(): ?string
  94.     {
  95.         return $this->name;
  96.     }
  97.     public function setName(string $name): self
  98.     {
  99.         $this->name $name;
  100.         return $this;
  101.     }
  102.     public function getDeadlineDays(): ?int
  103.     {
  104.         return $this->deadlineDays;
  105.     }
  106.     public function setDeadlineDays(int $deadlineDays): self
  107.     {
  108.         $this->deadlineDays $deadlineDays;
  109.         return $this;
  110.     }
  111.     public function getPosition(): ?int
  112.     {
  113.         return $this->position;
  114.     }
  115.     public function setPosition(int $position): self
  116.     {
  117.         $this->position $position;
  118.         return $this;
  119.     }
  120.     public function getIsDone(): ?bool
  121.     {
  122.         return $this->isDone;
  123.     }
  124.     public function setIsDone(bool $isDone): self
  125.     {
  126.         $this->isDone $isDone;
  127.         return $this;
  128.     }
  129.     public function getDepartment(): ?ContractTasksDepartment
  130.     {
  131.         return $this->department;
  132.     }
  133.     public function setDepartment(?ContractTasksDepartment $department): self
  134.     {
  135.         $this->department $department;
  136.         return $this;
  137.     }
  138.     public function getFinishedAt(): ?\DateTimeInterface
  139.     {
  140.         return $this->finishedAt;
  141.     }
  142.     public function setFinishedAt(?\DateTimeInterface $finishedAt): self
  143.     {
  144.         $this->finishedAt $finishedAt;
  145.         return $this;
  146.     }
  147.     public function getFinishedBy(): ?User
  148.     {
  149.         return $this->finishedBy;
  150.     }
  151.     public function setFinishedBy(?User $finishedBy): self
  152.     {
  153.         $this->finishedBy $finishedBy;
  154.         return $this;
  155.     }
  156.     public function isIsDone(): ?bool
  157.     {
  158.         return $this->isDone;
  159.     }
  160.     /**
  161.      * @return Collection<int, ContractTasksDepartmentTaskNote>
  162.      */
  163.     public function getNotes(): Collection
  164.     {
  165.         return $this->notes;
  166.     }
  167.     public function addNote(ContractTasksDepartmentTaskNote $note): self
  168.     {
  169.         if (!$this->notes->contains($note)) {
  170.             $this->notes->add($note);
  171.             $note->setTask($this);
  172.         }
  173.         return $this;
  174.     }
  175.     public function removeNote(ContractTasksDepartmentTaskNote $note): self
  176.     {
  177.         if ($this->notes->removeElement($note)) {
  178.             // set the owning side to null (unless already changed)
  179.             if ($note->getTask() === $this) {
  180.                 $note->setTask(null);
  181.             }
  182.         }
  183.         return $this;
  184.     }
  185. }