src/Entity/User.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\Common\Collections\Collection;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use Sonata\UserBundle\Entity\BaseUser;
  7. /**
  8.  * @ORM\Entity
  9.  * @ORM\Table(name="user")
  10.  */
  11. class User extends BaseUser
  12. {
  13.     const USER_ZSOLT 1;
  14.     /**
  15.      * @var int
  16.      * @ORM\Id
  17.      * @ORM\GeneratedValue
  18.      * @ORM\Column(type="integer")
  19.      */
  20.     protected $id;
  21.     /**
  22.      * @var string
  23.      * @ORM\Column(type="string", length=100, unique=true, nullable=true)
  24.      */
  25.     private ?string $name;
  26.     /**
  27.      * @ORM\OneToMany(targetEntity=Task::class, mappedBy="assignedUser")
  28.      */
  29.     private $assignedTasks;
  30.     /**
  31.      * @ORM\OneToMany(targetEntity=TaskLog::class, mappedBy="user", orphanRemoval=true)
  32.      */
  33.     private $taskLogs;
  34.     /**
  35.      * @ORM\Column(type="string", length=255, nullable=true)
  36.      */
  37.     private $phone;
  38.     /**
  39.      * @ORM\OneToMany(targetEntity=CashOut::class, mappedBy="user")
  40.      */
  41.     private $cashOuts;
  42.     /**
  43.      * @ORM\OneToMany(targetEntity=AnualLeave::class, mappedBy="userOnHoliday")
  44.      */
  45.     private $userAnualLeavs;
  46.     public function __construct()
  47.     {
  48.         $this->assignedTasks = new ArrayCollection();
  49.         $this->taskLogs = new ArrayCollection();
  50.         $this->cashOuts = new ArrayCollection();
  51.         $this->userAnualLeavs = new ArrayCollection();
  52.     }
  53.     public function getName(): ?string
  54.     {
  55.         return $this->name;
  56.     }
  57.     public function setName(?string $name): void
  58.     {
  59.         $this->name $name;
  60.     }
  61.     /**
  62.      * @return Collection<int, Task>
  63.      */
  64.     public function getAssignedTasks(): Collection
  65.     {
  66.         return $this->assignedTasks;
  67.     }
  68.     public function addAssignedTask(Task $assignedTask): self
  69.     {
  70.         if (!$this->assignedTasks->contains($assignedTask)) {
  71.             $this->assignedTasks[] = $assignedTask;
  72.             $assignedTask->setAssignedUser($this);
  73.         }
  74.         return $this;
  75.     }
  76.     public function removeAssignedTask(Task $assignedTask): self
  77.     {
  78.         if ($this->assignedTasks->removeElement($assignedTask)) {
  79.             // set the owning side to null (unless already changed)
  80.             if ($assignedTask->getAssignedUser() === $this) {
  81.                 $assignedTask->setAssignedUser(null);
  82.             }
  83.         }
  84.         return $this;
  85.     }
  86.     /**
  87.      * @return Collection<int, TaskLog>
  88.      */
  89.     public function getTaskLogs(): Collection
  90.     {
  91.         return $this->taskLogs;
  92.     }
  93.     public function addTaskLog(TaskLog $taskLog): self
  94.     {
  95.         if (!$this->taskLogs->contains($taskLog)) {
  96.             $this->taskLogs[] = $taskLog;
  97.             $taskLog->setUser($this);
  98.         }
  99.         return $this;
  100.     }
  101.     public function removeTaskLog(TaskLog $taskLog): self
  102.     {
  103.         if ($this->taskLogs->removeElement($taskLog)) {
  104.             // set the owning side to null (unless already changed)
  105.             if ($taskLog->getUser() === $this) {
  106.                 $taskLog->setUser(null);
  107.             }
  108.         }
  109.         return $this;
  110.     }
  111.     public function getPhone(): ?string
  112.     {
  113.         return $this->phone;
  114.     }
  115.     public function setPhone(?string $phone): self
  116.     {
  117.         $this->phone $phone;
  118.         return $this;
  119.     }
  120.     /**
  121.      * @return Collection<int, CashOut>
  122.      */
  123.     public function getCashOuts(): Collection
  124.     {
  125.         return $this->cashOuts;
  126.     }
  127.     public function addCashOut(CashOut $cashOut): self
  128.     {
  129.         if (!$this->cashOuts->contains($cashOut)) {
  130.             $this->cashOuts[] = $cashOut;
  131.             $cashOut->setUser($this);
  132.         }
  133.         return $this;
  134.     }
  135.     public function removeCashOut(CashOut $cashOut): self
  136.     {
  137.         if ($this->cashOuts->removeElement($cashOut)) {
  138.             // set the owning side to null (unless already changed)
  139.             if ($cashOut->getUser() === $this) {
  140.                 $cashOut->setUser(null);
  141.             }
  142.         }
  143.         return $this;
  144.     }
  145.     public function getUserAnualLeavs(): ArrayCollection
  146.     {
  147.         return $this->userAnualLeavs;
  148.     }
  149.     public function setUserAnualLeavs(ArrayCollection $userAnualLeavs): void
  150.     {
  151.         $this->userAnualLeavs $userAnualLeavs;
  152.     }
  153.     /**
  154.      * @return Collection<int, AnualLeave>
  155.      */
  156.     public function getUserAnualLeave(): Collection
  157.     {
  158.         return $this->cashOuts;
  159.     }
  160.     public function addAnualLeave(AnualLeave $anualLeave): self
  161.     {
  162.         if (!$this->cashOuts->contains($anualLeave)) {
  163.             $this->cashOuts[] = $anualLeave;
  164.             $anualLeave->setUser($this);
  165.         }
  166.         return $this;
  167.     }
  168.     public function removeAnualLeave(AnualLeave $anualLeave): self
  169.     {
  170.         if ($this->cashOuts->removeElement($anualLeave)) {
  171.             // set the owning side to null (unless already changed)
  172.             if ($anualLeave->getUser() === $this) {
  173.                 $anualLeave->setUser(null);
  174.             }
  175.         }
  176.         return $this;
  177.     }
  178. }