src/Entity/AnualLeave.php line 16

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Entity\Base\AbstractTimestampableEntity;
  4. use App\Repository\AnualLeaveRepository;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use Symfony\Component\Validator\Constraints as Assert;
  7. use Symfony\Component\Validator\Mapping\ClassMetadata;
  8. use Symfony\Component\Validator\Constraints\GreaterThanOrEqual;
  9. /**
  10.  * @ORM\Entity(repositoryClass=AnualLeaveRepository::class)
  11.  * @ORM\HasLifecycleCallbacks
  12.  */
  13. class AnualLeave extends AbstractTimestampableEntity
  14. {
  15.     /**
  16.      * @ORM\Column(type="string", length=255)
  17.      */
  18.     private $name;
  19.     /**
  20.      * @ORM\Column(type="text", nullable=true)
  21.      */
  22.     private $description;
  23.     /**
  24.      * @ORM\Column(type="date")
  25.      */
  26.     private $startDate;
  27.     /**
  28.      * @ORM\Column(type="date")
  29.      */
  30.     private $endDate;
  31.     /**
  32.      * @ORM\ManyToOne(targetEntity=AnualLeaveType::class, inversedBy="anualLeaves")
  33.      * @ORM\JoinColumn(nullable=false)
  34.      */
  35.     private $anualLeaveType;
  36.     /**
  37.      * @ORM\ManyToOne(targetEntity=User::class, inversedBy="userAnualLeavs")
  38.      */
  39.     private $userOnHoliday;
  40.     /**
  41.      * @ORM\Column(type="boolean",options={"default":false})
  42.      */
  43.     private bool $deleted false;
  44.     /**
  45.      * @ORM\Column(type="boolean",options={"default":false})
  46.      */
  47.     private bool $accepted false;
  48.     /**
  49.      * Nem mozgatható nap (pl. hétvégi hivatalos szabadnap)
  50.      * @ORM\Column(type="boolean", options={"default":false})
  51.      */
  52.     private bool $fixed false;
  53.     /**
  54.      * Kapcsolat a hivatalos szabadnappal (ha generálásból jött)
  55.      * @ORM\ManyToOne(targetEntity=OfficialHoliday::class)
  56.      * @ORM\JoinColumn(nullable=true, onDelete="SET NULL")
  57.      */
  58.     private ?OfficialHoliday $officialHoliday null;
  59.     public function getName(): ?string
  60.     {
  61.         return $this->name;
  62.     }
  63.     public function setName(string $name): self
  64.     {
  65.         $this->name $name;
  66.         return $this;
  67.     }
  68.     public function getDescription(): ?string
  69.     {
  70.         return $this->description;
  71.     }
  72.     public function setDescription(?string $description): self
  73.     {
  74.         $this->description $description;
  75.         return $this;
  76.     }
  77.     public function getStartDate(): ?\DateTimeInterface
  78.     {
  79.         return $this->startDate;
  80.     }
  81.     public function setStartDate(\DateTimeInterface $startDate): self
  82.     {
  83.         $this->startDate $startDate;
  84.         return $this;
  85.     }
  86.     public function getEndDate(): ?\DateTimeInterface
  87.     {
  88.         return $this->endDate;
  89.     }
  90.     public function setEndDate(\DateTimeInterface $endDate): self
  91.     {
  92.         $this->endDate $endDate;
  93.         return $this;
  94.     }
  95.     public function getAnualLeaveType(): ?AnualLeaveType
  96.     {
  97.         return $this->anualLeaveType;
  98.     }
  99.     public function setAnualLeaveType(?AnualLeaveType $anualLeaveType): self
  100.     {
  101.         $this->anualLeaveType $anualLeaveType;
  102.         return $this;
  103.     }
  104.     public function getUserOnHoliday()
  105.     {
  106.         return $this->userOnHoliday;
  107.     }
  108.     public function setUserOnHoliday($userOnHoliday): self
  109.     {
  110.         $this->userOnHoliday $userOnHoliday;
  111.         return $this;
  112.     }
  113.     public static function loadValidatorMetadata(ClassMetadata $metadata): void
  114.     {
  115.         $metadata->addPropertyConstraint('endDate',
  116.                     new Assert\GreaterThanOrEqual([
  117.                         'propertyPath' => 'startDate',
  118.                         'message' => 'A végdátumnak nagyobbnak vagy egyenlőnek kell lennie a kezdeti dátummal.']));
  119.     }
  120.     public function __toString(): string
  121.     {
  122.         return $this->getName();
  123.     }
  124.     public function isDeleted(): bool
  125.     {
  126.         return $this->deleted;
  127.     }
  128.     public function setDeleted(bool $deleted): self
  129.     {
  130.         $this->deleted $deleted;
  131.         return $this;
  132.     }
  133.     public function isAccepted(): bool
  134.     {
  135.         return $this->accepted;
  136.     }
  137.     public function setAccepted(bool $accepted): self
  138.     {
  139.         $this->accepted $accepted;
  140.         return $this;
  141.     }
  142.     public function isFixed(): bool
  143.     {
  144.         return $this->fixed;
  145.     }
  146.     public function setFixed(bool $fixed): self
  147.     {
  148.         $this->fixed $fixed;
  149.         return $this;
  150.     }
  151.     public function getOfficialHoliday(): ?OfficialHoliday
  152.     {
  153.         return $this->officialHoliday;
  154.     }
  155.     public function setOfficialHoliday(?OfficialHoliday $officialHoliday): self
  156.     {
  157.         $this->officialHoliday $officialHoliday;
  158.         return $this;
  159.     }
  160. }