src/Entity/Title.php line 13

  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\TitleRepository;
  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. use Gedmo\Timestampable\Traits\TimestampableEntity;
  9. #[ORM\Entity(repositoryClassTitleRepository::class)]
  10. class Title
  11. {
  12.     use TimestampableEntity;
  13.     #[ORM\Id]
  14.     #[ORM\GeneratedValue]
  15.     #[ORM\Column]
  16.     private ?int $id null;
  17.     #[ORM\Column(length255)]
  18.     private ?string $name null;
  19.     #[ORM\ManyToOne(inversedBy'titles')]
  20.     #[ORM\JoinColumn(nullabletrue)]
  21.     private ?Year $year null;
  22.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  23.     private ?string $description null;
  24.     #[ORM\OneToMany(mappedBy'title'targetEntityPosition::class)]
  25.     private Collection $positions;
  26.     #[ORM\OneToMany(mappedBy'title'targetEntityQuotaAssignment::class)]
  27.     private Collection $quotaAssignments;
  28.     #[ORM\OneToMany(mappedBy'title'targetEntityUser::class)]
  29.     private Collection $users;
  30.     #[ORM\OneToMany(mappedBy'title'targetEntityRateTableAssignment::class)]
  31.     private Collection $rateTableAssignments;
  32.     #[ORM\OneToMany(mappedBy'title'targetEntityPlanAssignment::class)]
  33.     private Collection $planAssignments;
  34.     #[ORM\ManyToMany(targetEntityMessage::class, mappedBy'titles')]
  35.     private Collection $messages;
  36.     #[ORM\Column]
  37.     private ?bool $displayOnPayrollReportFilter false;
  38.     public function __construct()
  39.     {
  40.         $this->positions = new ArrayCollection();
  41.         $this->quotaAssignments = new ArrayCollection();
  42.         $this->users = new ArrayCollection();
  43.         $this->rateTableAssignments = new ArrayCollection();
  44.         $this->planAssignments = new ArrayCollection();
  45.         $this->messages = new ArrayCollection();
  46.     }
  47.     public function getId(): ?int
  48.     {
  49.         return $this->id;
  50.     }
  51.     public function getName(): ?string
  52.     {
  53.         return $this->name;
  54.     }
  55.     public function setName(string $name): self
  56.     {
  57.         $this->name $name;
  58.         return $this;
  59.     }
  60.     public function __toString()
  61.     {
  62.         return (string)$this->name;
  63.     }
  64.     public function getYear(): ?Year
  65.     {
  66.         return $this->year;
  67.     }
  68.     public function setYear(?Year $year): self
  69.     {
  70.         $this->year $year;
  71.         return $this;
  72.     }
  73.     public function getDescription(): ?string
  74.     {
  75.         return $this->description;
  76.     }
  77.     public function setDescription(?string $description): static
  78.     {
  79.         $this->description $description;
  80.         return $this;
  81.     }
  82.     /**
  83.      * @return Collection<int, Position>
  84.      */
  85.     public function getPositions(): Collection
  86.     {
  87.         return $this->positions;
  88.     }
  89.     public function addPosition(Position $position): static
  90.     {
  91.         if (!$this->positions->contains($position)) {
  92.             $this->positions->add($position);
  93.             $position->setTitle($this);
  94.         }
  95.         return $this;
  96.     }
  97.     public function removePosition(Position $position): static
  98.     {
  99.         if ($this->positions->removeElement($position)) {
  100.             // set the owning side to null (unless already changed)
  101.             if ($position->getTitle() === $this) {
  102.                 $position->setTitle(null);
  103.             }
  104.         }
  105.         return $this;
  106.     }
  107.     /**
  108.      * @return Collection<int, QuotaAssignment>
  109.      */
  110.     public function getQuotaAssignments(): Collection
  111.     {
  112.         return $this->quotaAssignments;
  113.     }
  114.     public function addQuotaAssignment(QuotaAssignment $quotaAssignment): self
  115.     {
  116.         if (!$this->quotaAssignments->contains($quotaAssignment)) {
  117.             $this->quotaAssignments->add($quotaAssignment);
  118.             $quotaAssignment->setTitle($this);
  119.         }
  120.         return $this;
  121.     }
  122.     public function removeQuotaAssignment(QuotaAssignment $quotaAssignment): self
  123.     {
  124.         if ($this->quotaAssignments->removeElement($quotaAssignment)) {
  125.             // set the owning side to null (unless already changed)
  126.             if ($quotaAssignment->getTitle() === $this) {
  127.                 $quotaAssignment->setTitle(null);
  128.             }
  129.         }
  130.         return $this;
  131.     }
  132.     /**
  133.      * @return Collection<int, User>
  134.      */
  135.     public function getUsers(): Collection
  136.     {
  137.         return $this->users;
  138.     }
  139.     public function addUser(User $user): static
  140.     {
  141.         if (!$this->users->contains($user)) {
  142.             $this->users->add($user);
  143.             $user->setTitle($this);
  144.         }
  145.         return $this;
  146.     }
  147.     public function removeUser(User $user): static
  148.     {
  149.         if ($this->users->removeElement($user)) {
  150.             // set the owning side to null (unless already changed)
  151.             if ($user->getTitle() === $this) {
  152.                 $user->setTitle(null);
  153.             }
  154.         }
  155.         return $this;
  156.     }
  157.     /**
  158.      * @return Collection<int, RateTableAssignment>
  159.      */
  160.     public function getRateTableAssignments(): Collection
  161.     {
  162.         return $this->rateTableAssignments;
  163.     }
  164.     public function addRateTableAssignment(RateTableAssignment $rateTableAssignment): static
  165.     {
  166.         if (!$this->rateTableAssignments->contains($rateTableAssignment)) {
  167.             $this->rateTableAssignments->add($rateTableAssignment);
  168.             $rateTableAssignment->setTitle($this);
  169.         }
  170.         return $this;
  171.     }
  172.     public function removeRateTableAssignment(RateTableAssignment $rateTableAssignment): static
  173.     {
  174.         if ($this->rateTableAssignments->removeElement($rateTableAssignment)) {
  175.             // set the owning side to null (unless already changed)
  176.             if ($rateTableAssignment->getTitle() === $this) {
  177.                 $rateTableAssignment->setTitle(null);
  178.             }
  179.         }
  180.         return $this;
  181.     }
  182.     /**
  183.      * @return Collection<int, PlanAssignment>
  184.      */
  185.     public function getPlanAssignments(): Collection
  186.     {
  187.         return $this->planAssignments;
  188.     }
  189.     public function addPlanAssignment(PlanAssignment $planAssignment): static
  190.     {
  191.         if (!$this->planAssignments->contains($planAssignment)) {
  192.             $this->planAssignments->add($planAssignment);
  193.             $planAssignment->setTitle($this);
  194.         }
  195.         return $this;
  196.     }
  197.     public function removePlanAssignment(PlanAssignment $planAssignment): static
  198.     {
  199.         if ($this->planAssignments->removeElement($planAssignment)) {
  200.             // set the owning side to null (unless already changed)
  201.             if ($planAssignment->getTitle() === $this) {
  202.                 $planAssignment->setTitle(null);
  203.             }
  204.         }
  205.         return $this;
  206.     }
  207.     /**
  208.      * @return Collection<int, Message>
  209.      */
  210.     public function getMessages(): Collection
  211.     {
  212.         return $this->messages;
  213.     }
  214.     public function addMessage(Message $message): static
  215.     {
  216.         if (!$this->messages->contains($message)) {
  217.             $this->messages->add($message);
  218.             $message->addTitle($this);
  219.         }
  220.         return $this;
  221.     }
  222.     public function removeMessage(Message $message): static
  223.     {
  224.         if ($this->messages->removeElement($message)) {
  225.             $message->removeTitle($this);
  226.         }
  227.         return $this;
  228.     }
  229.     public function isDisplayOnPayrollReportFilter(): ?bool
  230.     {
  231.         return $this->displayOnPayrollReportFilter;
  232.     }
  233.     public function setDisplayOnPayrollReportFilter(bool $displayOnPayrollReportFilter): static
  234.     {
  235.         $this->displayOnPayrollReportFilter $displayOnPayrollReportFilter;
  236.         return $this;
  237.     }
  238. }