src/Entity/Position.php line 13

  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\PositionRepository;
  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(repositoryClassPositionRepository::class)]
  10. class Position
  11. {
  12.     use TimestampableEntity;
  13.     #[ORM\Id]
  14.     #[ORM\GeneratedValue]
  15.     #[ORM\Column]
  16.     private ?int $id null;
  17.     #[ORM\Column(length255nullabletrue)]
  18.     private ?string $name null;
  19.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  20.     private ?string $description null;
  21.     #[ORM\Column(typeTypes::DATE_MUTABLEnullabletrue)]
  22.     private ?\DateTimeInterface $incentiveStartDate null;
  23.     #[ORM\Column(typeTypes::DATE_MUTABLEnullabletrue)]
  24.     private ?\DateTimeInterface $incentiveEndDate null;
  25.     #[ORM\Column(typeTypes::DATE_MUTABLEnullabletrue)]
  26.     private ?\DateTimeInterface $effectiveStartDate null;
  27.     #[ORM\ManyToOne(inversedBy'positions'fetch'EAGER')]
  28.     private ?Title $title null;
  29.     #[ORM\ManyToOne(inversedBy'positions')]
  30.     private ?User $user null;
  31.     #[ORM\OneToMany(mappedBy'position'targetEntityHierarchy::class, orphanRemovaltrue)]
  32.     private Collection $hierarchies;
  33.     #[ORM\OneToMany(mappedBy'parentPosition'targetEntityHierarchy::class)]
  34.     private Collection $parentHierarchies;
  35.     #[ORM\OneToMany(mappedBy'position'targetEntityQuotaAssignment::class)]
  36.     private Collection $quotaAssignments;
  37.     #[ORM\OneToMany(mappedBy'fromPosition'targetEntityNamedRelationshipPosition::class)]
  38.     private Collection $namedRelationshipPositions;
  39.     #[ORM\OneToMany(mappedBy'toPosition'targetEntityNamedRelationshipPosition::class)]
  40.     private Collection $namedRelationshipPositionsTo;
  41.     #[ORM\OneToMany(mappedBy'position'targetEntityRuleCondition::class)]
  42.     private Collection $ruleConditions;
  43.     #[ORM\OneToMany(mappedBy'position'targetEntityCommission::class)]
  44.     private Collection $commissions;
  45.     #[ORM\OneToMany(mappedBy'position'targetEntityCredit::class)]
  46.     private Collection $credits;
  47.     #[ORM\OneToMany(mappedBy'position'targetEntityLookUpTable::class)]
  48.     private Collection $lookUpTables;
  49.     public function __construct()
  50.     {
  51.         $this->hierarchies = new ArrayCollection();
  52.         $this->parentHierarchies = new ArrayCollection();
  53.         $this->quotaAssignments = new ArrayCollection();
  54.         $this->namedRelationshipPositions = new ArrayCollection();
  55.         $this->namedRelationshipPositionsTo = new ArrayCollection();
  56.         $this->ruleConditions = new ArrayCollection();
  57.         $this->commissions = new ArrayCollection();
  58.         $this->credits = new ArrayCollection();
  59.         $this->lookUpTables = new ArrayCollection();
  60.     }
  61.     public function getId(): ?int
  62.     {
  63.         return $this->id;
  64.     }
  65.     public function getName(): ?string
  66.     {
  67.         return $this->name;
  68.     }
  69.     public function setName(?string $name): static
  70.     {
  71.         $this->name $name;
  72.         return $this;
  73.     }
  74.     public function getDescription(): ?string
  75.     {
  76.         return $this->description;
  77.     }
  78.     public function setDescription(?string $description): static
  79.     {
  80.         $this->description $description;
  81.         return $this;
  82.     }
  83.     public function getIncentiveStartDate(): ?\DateTimeInterface
  84.     {
  85.         return $this->incentiveStartDate;
  86.     }
  87.     public function setIncentiveStartDate(?\DateTimeInterface $incentiveStartDate): static
  88.     {
  89.         $this->incentiveStartDate $incentiveStartDate;
  90.         return $this;
  91.     }
  92.     public function getIncentiveEndDate(): ?\DateTimeInterface
  93.     {
  94.         return $this->incentiveEndDate;
  95.     }
  96.     public function setIncentiveEndDate(?\DateTimeInterface $incentiveEndDate): static
  97.     {
  98.         $this->incentiveEndDate $incentiveEndDate;
  99.         return $this;
  100.     }
  101.     public function getEffectiveStartDate(): ?\DateTimeInterface
  102.     {
  103.         return $this->effectiveStartDate;
  104.     }
  105.     public function setEffectiveStartDate(?\DateTimeInterface $effectiveStartDate): static
  106.     {
  107.         $this->effectiveStartDate $effectiveStartDate;
  108.         return $this;
  109.     }
  110.     public function getTitle(): ?Title
  111.     {
  112.         return $this->title;
  113.     }
  114.     public function setTitle(?Title $title): static
  115.     {
  116.         $this->title $title;
  117.         return $this;
  118.     }
  119.     public function getUser(): ?User
  120.     {
  121.         return $this->user;
  122.     }
  123.     public function setUser(?User $user): static
  124.     {
  125.         $this->user $user;
  126.         return $this;
  127.     }
  128.     /**
  129.      * @return Collection<int, Hierarchy>
  130.      */
  131.     public function getHierarchies(): Collection
  132.     {
  133.         return $this->hierarchies;
  134.     }
  135.     public function addHierarchy(Hierarchy $hierarchy): static
  136.     {
  137.         if (!$this->hierarchies->contains($hierarchy)) {
  138.             $this->hierarchies->add($hierarchy);
  139.             $hierarchy->setPosition($this);
  140.         }
  141.         return $this;
  142.     }
  143.     public function removeHierarchy(Hierarchy $hierarchy): static
  144.     {
  145.         if ($this->hierarchies->removeElement($hierarchy)) {
  146.             // set the owning side to null (unless already changed)
  147.             if ($hierarchy->getPosition() === $this) {
  148.                 $hierarchy->setPosition(null);
  149.             }
  150.         }
  151.         return $this;
  152.     }
  153.     /**
  154.      * @return Collection<int, Hierarchy>
  155.      */
  156.     public function getParentHierarchies(): Collection
  157.     {
  158.         return $this->parentHierarchies;
  159.     }
  160.     public function addParentHierarchy(Hierarchy $parentHierarchy): static
  161.     {
  162.         if (!$this->parentHierarchies->contains($parentHierarchy)) {
  163.             $this->parentHierarchies->add($parentHierarchy);
  164.             $parentHierarchy->setParentPosition($this);
  165.         }
  166.         return $this;
  167.     }
  168.     public function removeParentHierarchy(Hierarchy $parentHierarchy): static
  169.     {
  170.         if ($this->parentHierarchies->removeElement($parentHierarchy)) {
  171.             // set the owning side to null (unless already changed)
  172.             if ($parentHierarchy->getParentPosition() === $this) {
  173.                 $parentHierarchy->setParentPosition(null);
  174.             }
  175.         }
  176.         return $this;
  177.     }
  178.     /**
  179.      * @return Collection<int, QuotaAssignment>
  180.      */
  181.     public function getQuotaAssignments(): Collection
  182.     {
  183.         return $this->quotaAssignments;
  184.     }
  185.     public function addQuotaAssignment(QuotaAssignment $quotaAssignment): self
  186.     {
  187.         if (!$this->quotaAssignments->contains($quotaAssignment)) {
  188.             $this->quotaAssignments->add($quotaAssignment);
  189.             $quotaAssignment->setPosition($this);
  190.         }
  191.         return $this;
  192.     }
  193.     public function removeQuotaAssignment(QuotaAssignment $quotaAssignment): self
  194.     {
  195.         if ($this->quotaAssignments->removeElement($quotaAssignment)) {
  196.             // set the owning side to null (unless already changed)
  197.             if ($quotaAssignment->getPosition() === $this) {
  198.                 $quotaAssignment->setPosition(null);
  199.             }
  200.         }
  201.         return $this;
  202.     }
  203.     /**
  204.      * @return Collection<int, NamedRelationshipPosition>
  205.      */
  206.     public function getNamedRelationshipPositions(): Collection
  207.     {
  208.         return $this->namedRelationshipPositions;
  209.     }
  210.     public function addNamedRelationshipPosition(NamedRelationshipPosition $namedRelationshipPosition): self
  211.     {
  212.         if (!$this->namedRelationshipPositions->contains($namedRelationshipPosition)) {
  213.             $this->namedRelationshipPositions->add($namedRelationshipPosition);
  214.             $namedRelationshipPosition->setFromPosition($this);
  215.         }
  216.         return $this;
  217.     }
  218.     public function removeNamedRelationshipPosition(NamedRelationshipPosition $namedRelationshipPosition): self
  219.     {
  220.         if ($this->namedRelationshipPositions->removeElement($namedRelationshipPosition)) {
  221.             // set the owning side to null (unless already changed)
  222.             if ($namedRelationshipPosition->getFromPosition() === $this) {
  223.                 $namedRelationshipPosition->setFromPosition(null);
  224.             }
  225.         }
  226.         return $this;
  227.     }
  228.     /**
  229.      * @return Collection<int, NamedRelationshipPosition>
  230.      */
  231.     public function getNamedRelationshipPositionsTo(): Collection
  232.     {
  233.         return $this->namedRelationshipPositionsTo;
  234.     }
  235.     public function addNamedRelationshipPositionsTo(NamedRelationshipPosition $namedRelationshipPositionsTo): self
  236.     {
  237.         if (!$this->namedRelationshipPositionsTo->contains($namedRelationshipPositionsTo)) {
  238.             $this->namedRelationshipPositionsTo->add($namedRelationshipPositionsTo);
  239.             $namedRelationshipPositionsTo->setToPosition($this);
  240.         }
  241.         return $this;
  242.     }
  243.     public function removeNamedRelationshipPositionsTo(NamedRelationshipPosition $namedRelationshipPositionsTo): self
  244.     {
  245.         if ($this->namedRelationshipPositionsTo->removeElement($namedRelationshipPositionsTo)) {
  246.             // set the owning side to null (unless already changed)
  247.             if ($namedRelationshipPositionsTo->getToPosition() === $this) {
  248.                 $namedRelationshipPositionsTo->setToPosition(null);
  249.             }
  250.         }
  251.         return $this;
  252.     }
  253.     /**
  254.      * @return Collection<int, RuleCondition>
  255.      */
  256.     public function getRuleConditions(): Collection
  257.     {
  258.         return $this->ruleConditions;
  259.     }
  260.     public function addRuleCondition(RuleCondition $ruleCondition): self
  261.     {
  262.         if (!$this->ruleConditions->contains($ruleCondition)) {
  263.             $this->ruleConditions->add($ruleCondition);
  264.             $ruleCondition->setPosition($this);
  265.         }
  266.         return $this;
  267.     }
  268.     public function removeRuleCondition(RuleCondition $ruleCondition): self
  269.     {
  270.         if ($this->ruleConditions->removeElement($ruleCondition)) {
  271.             // set the owning side to null (unless already changed)
  272.             if ($ruleCondition->getPosition() === $this) {
  273.                 $ruleCondition->setPosition(null);
  274.             }
  275.         }
  276.         return $this;
  277.     }
  278.     public function __toString(): string
  279.     {
  280.         return (string)$this->name;
  281.     }
  282.     /**
  283.      * @return Collection<int, Commission>
  284.      */
  285.     public function getCommissions(): Collection
  286.     {
  287.         return $this->commissions;
  288.     }
  289.     public function addCommission(Commission $commission): static
  290.     {
  291.         if (!$this->commissions->contains($commission)) {
  292.             $this->commissions->add($commission);
  293.             $commission->setPosition($this);
  294.         }
  295.         return $this;
  296.     }
  297.     public function removeCommission(Commission $commission): static
  298.     {
  299.         if ($this->commissions->removeElement($commission)) {
  300.             // set the owning side to null (unless already changed)
  301.             if ($commission->getPosition() === $this) {
  302.                 $commission->setPosition(null);
  303.             }
  304.         }
  305.         return $this;
  306.     }
  307.     /**
  308.      * @return Collection<int, Credit>
  309.      */
  310.     public function getCredits(): Collection
  311.     {
  312.         return $this->credits;
  313.     }
  314.     public function addCredit(Credit $credit): static
  315.     {
  316.         if (!$this->credits->contains($credit)) {
  317.             $this->credits->add($credit);
  318.             $credit->setPosition($this);
  319.         }
  320.         return $this;
  321.     }
  322.     public function removeCredit(Credit $credit): static
  323.     {
  324.         if ($this->credits->removeElement($credit)) {
  325.             // set the owning side to null (unless already changed)
  326.             if ($credit->getPosition() === $this) {
  327.                 $credit->setPosition(null);
  328.             }
  329.         }
  330.         return $this;
  331.     }
  332.     /**
  333.      * @return Collection<int, LookUpTable>
  334.      */
  335.     public function getLookUpTables(): Collection
  336.     {
  337.         return $this->lookUpTables;
  338.     }
  339.     public function addLookUpTable(LookUpTable $lookUpTable): static
  340.     {
  341.         if (!$this->lookUpTables->contains($lookUpTable)) {
  342.             $this->lookUpTables->add($lookUpTable);
  343.             $lookUpTable->setPosition($this);
  344.         }
  345.         return $this;
  346.     }
  347.     public function removeLookUpTable(LookUpTable $lookUpTable): static
  348.     {
  349.         if ($this->lookUpTables->removeElement($lookUpTable)) {
  350.             // set the owning side to null (unless already changed)
  351.             if ($lookUpTable->getPosition() === $this) {
  352.                 $lookUpTable->setPosition(null);
  353.             }
  354.         }
  355.         return $this;
  356.     }
  357. }