src/Entity/LookUpTable.php line 15

  1. <?php
  2. namespace App\Entity;
  3. use App\Enum\LookUpTableAssignmentType;
  4. use App\Enum\LookUpTableReturnValueType;
  5. use App\Repository\LookUpTableRepository;
  6. use Doctrine\Common\Collections\ArrayCollection;
  7. use Doctrine\Common\Collections\Collection;
  8. use Doctrine\DBAL\Types\Types;
  9. use Doctrine\ORM\Mapping as ORM;
  10. use Gedmo\Timestampable\Traits\TimestampableEntity;
  11. #[ORM\Entity(repositoryClassLookUpTableRepository::class)]
  12. class LookUpTable
  13. {
  14.     use TimestampableEntity;
  15.     #[ORM\Id]
  16.     #[ORM\GeneratedValue]
  17.     #[ORM\Column]
  18.     private ?int $id null;
  19.     #[ORM\Column(length255)]
  20.     private ?string $name null;
  21.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  22.     private ?string $description null;
  23.     #[ORM\Column(length255nullabletrue)]
  24.     private ?LookUpTableReturnValueType $returnValueType null;
  25.     #[ORM\Column(length255)]
  26.     private ?LookUpTableAssignmentType $assignmentType LookUpTableAssignmentType::PLAN;
  27.     #[ORM\ManyToOne(targetEntityself::class, inversedBy'assignments')]
  28.     private ?self $parent null;
  29.     #[ORM\OneToMany(mappedBy'parent'targetEntityself::class)]
  30.     private Collection $assignments;
  31.     #[ORM\OneToMany(mappedBy'lookUpTable'targetEntityLookUpTableData::class, cascade: ['persist''remove'])]
  32.     private Collection $lookUpTableData;
  33.     #[ORM\OneToMany(mappedBy'lookUpTable'targetEntityLookUpTableDimension::class)]
  34.     private Collection $lookUpTableDimensions;
  35.     #[ORM\Column(length500nullabletrue)]
  36.     private ?string $assignmentName null;
  37.     #[ORM\ManyToOne(inversedBy'lookUpTables'fetch'EAGER')]
  38.     private ?User $assignedUser null;
  39.     #[ORM\ManyToOne(inversedBy'lookUpTables')]
  40.     private ?Position $position null;
  41.     #[ORM\OneToMany(mappedBy'lookUpTable'targetEntityRuleResult::class)]
  42.     private Collection $ruleResults;
  43.     public function __construct()
  44.     {
  45.         $this->assignments = new ArrayCollection();
  46.         $this->lookUpTableData = new ArrayCollection();
  47.         $this->lookUpTableDimensions = new ArrayCollection();
  48.         $this->ruleResults = new ArrayCollection();
  49.     }
  50.     public function getId(): ?int
  51.     {
  52.         return $this->id;
  53.     }
  54.     public function getName(): ?string
  55.     {
  56.         return $this->name;
  57.     }
  58.     public function setName(string $name): static
  59.     {
  60.         $this->name $name;
  61.         return $this;
  62.     }
  63.     public function getDescription(): ?string
  64.     {
  65.         return $this->description;
  66.     }
  67.     public function setDescription(?string $description): static
  68.     {
  69.         $this->description $description;
  70.         return $this;
  71.     }
  72.     public function getReturnValueType(): ?LookUpTableReturnValueType
  73.     {
  74.         return $this->returnValueType;
  75.     }
  76.     public function setReturnValueType(?LookUpTableReturnValueType $returnValueType): static
  77.     {
  78.         $this->returnValueType $returnValueType;
  79.         return $this;
  80.     }
  81.     public function getAssignmentType(): ?LookUpTableAssignmentType
  82.     {
  83.         return $this->assignmentType;
  84.     }
  85.     public function setAssignmentType(LookUpTableAssignmentType $assignmentType): static
  86.     {
  87.         $this->assignmentType $assignmentType;
  88.         return $this;
  89.     }
  90.     public function getParent(): ?self
  91.     {
  92.         return $this->parent;
  93.     }
  94.     public function setParent(?self $parent): static
  95.     {
  96.         $this->parent $parent;
  97.         return $this;
  98.     }
  99.     /**
  100.      * @return Collection<int, self>
  101.      */
  102.     public function getAssignments(): Collection
  103.     {
  104.         return $this->assignments;
  105.     }
  106.     public function addAssignment(self $assignment): static
  107.     {
  108.         if (!$this->assignments->contains($assignment)) {
  109.             $this->assignments->add($assignment);
  110.             $assignment->setParent($this);
  111.         }
  112.         return $this;
  113.     }
  114.     public function removeAssignment(self $assignment): static
  115.     {
  116.         if ($this->assignments->removeElement($assignment)) {
  117.             // set the owning side to null (unless already changed)
  118.             if ($assignment->getParent() === $this) {
  119.                 $assignment->setParent(null);
  120.             }
  121.         }
  122.         return $this;
  123.     }
  124.     /**
  125.      * @return Collection<int, LookUpTableData>
  126.      */
  127.     public function getLookUpTableData(): Collection
  128.     {
  129.         return $this->lookUpTableData;
  130.     }
  131.     public function addLookUpTableDatum(LookUpTableData $lookUpTableData): static
  132.     {
  133.         if (!$this->lookUpTableData->contains($lookUpTableData)) {
  134.             $this->lookUpTableData->add($lookUpTableData);
  135.             $lookUpTableData->setLookUpTable($this);
  136.         }
  137.         return $this;
  138.     }
  139.     public function removeLookUpTableDatum(LookUpTableData $lookUpTableData): static
  140.     {
  141.         if ($this->lookUpTableData->removeElement($lookUpTableData)) {
  142.             // set the owning side to null (unless already changed)
  143.             if ($lookUpTableData->getLookUpTable() === $this) {
  144.                 $lookUpTableData->setLookUpTable(null);
  145.             }
  146.         }
  147.         return $this;
  148.     }
  149.     /**
  150.      * @return Collection<int, LookUpTableDimension>
  151.      */
  152.     public function getLookUpTableDimensions(): Collection
  153.     {
  154.         return $this->lookUpTableDimensions;
  155.     }
  156.     public function addLookUpTableDimension(LookUpTableDimension $lookUpTableDimension): static
  157.     {
  158.         if (!$this->lookUpTableDimensions->contains($lookUpTableDimension)) {
  159.             $this->lookUpTableDimensions->add($lookUpTableDimension);
  160.             $lookUpTableDimension->setLookUpTable($this);
  161.         }
  162.         return $this;
  163.     }
  164.     public function removeLookUpTableDimension(LookUpTableDimension $lookUpTableDimension): static
  165.     {
  166.         if ($this->lookUpTableDimensions->removeElement($lookUpTableDimension)) {
  167.             // set the owning side to null (unless already changed)
  168.             if ($lookUpTableDimension->getLookUpTable() === $this) {
  169.                 $lookUpTableDimension->setLookUpTable(null);
  170.             }
  171.         }
  172.         return $this;
  173.     }
  174.     public function getAssignmentName(): ?string
  175.     {
  176.         return $this->assignmentName;
  177.     }
  178.     public function setAssignmentName(?string $assignmentName): static
  179.     {
  180.         $this->assignmentName $assignmentName;
  181.         return $this;
  182.     }
  183.     public function getAssignedUser(): ?User
  184.     {
  185.         return $this->assignedUser;
  186.     }
  187.     public function setAssignedUser(?User $assignedUser): static
  188.     {
  189.         $this->assignedUser $assignedUser;
  190.         return $this;
  191.     }
  192.     public function getPosition(): ?Position
  193.     {
  194.         return $this->position;
  195.     }
  196.     public function setPosition(?Position $position): static
  197.     {
  198.         $this->position $position;
  199.         return $this;
  200.     }
  201.     /**
  202.      * @return Collection<int, RuleResult>
  203.      */
  204.     public function getRuleResults(): Collection
  205.     {
  206.         return $this->ruleResults;
  207.     }
  208.     public function addRuleResult(RuleResult $ruleResult): static
  209.     {
  210.         if (!$this->ruleResults->contains($ruleResult)) {
  211.             $this->ruleResults->add($ruleResult);
  212.             $ruleResult->setLookUpTable($this);
  213.         }
  214.         return $this;
  215.     }
  216.     public function removeRuleResult(RuleResult $ruleResult): static
  217.     {
  218.         if ($this->ruleResults->removeElement($ruleResult)) {
  219.             // set the owning side to null (unless already changed)
  220.             if ($ruleResult->getLookUpTable() === $this) {
  221.                 $ruleResult->setLookUpTable(null);
  222.             }
  223.         }
  224.         return $this;
  225.     }
  226.     public function __toString(): string
  227.     {
  228.         return (string)$this->name;
  229.     }
  230. }