src/Entity/RateTable.php line 14

  1. <?php
  2. namespace App\Entity;
  3. use App\Enum\AttainmentUnitType;
  4. use App\Repository\RateTableRepository;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\DBAL\Types\Types;
  8. use Doctrine\ORM\Mapping as ORM;
  9. use Gedmo\Timestampable\Traits\TimestampableEntity;
  10. #[ORM\Entity(repositoryClassRateTableRepository::class)]
  11. class RateTable
  12. {
  13.     use TimestampableEntity;
  14.     #[ORM\Id]
  15.     #[ORM\GeneratedValue]
  16.     #[ORM\Column]
  17.     private ?int $id null;
  18.     #[ORM\Column(length255)]
  19.     private ?string $name null;
  20.     #[ORM\Column]
  21.     private ?AttainmentUnitType $attainmentUnitType AttainmentUnitType::PERCENT;
  22.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  23.     private ?string $description null;
  24.     #[ORM\Column(typeTypes::DATETIME_MUTABLEnullabletrue)]
  25.     private ?\DateTimeInterface $effectiveStartDate null;
  26.     #[ORM\Column(typeTypes::DATETIME_MUTABLEnullabletrue)]
  27.     private ?\DateTimeInterface $effectiveEndDate null;
  28.     #[ORM\ManyToOne(targetEntityself::class, inversedBy'overrides')]
  29.     private ?self $parent null;
  30.     #[ORM\OneToMany(mappedBy'parent'targetEntityself::class, cascade: ['PERSIST'])]
  31.     private Collection $overrides;
  32.     #[ORM\ManyToOne]
  33.     private ?Title $title null;
  34.     #[ORM\ManyToOne]
  35.     private ?User $user null;
  36.     #[ORM\ManyToOne(inversedBy'rateTables')]
  37.     private ?Year $year null;
  38.     #[ORM\ManyToOne]
  39.     private ?CreditType $creditType null;
  40.     #[ORM\OneToMany(mappedBy'rateTable'targetEntityCommission::class)]
  41.     private Collection $commissions;
  42.     #[ORM\OneToMany(mappedBy'rateTable'targetEntityRateTableAssignment::class, cascade: ['persist''remove'])]
  43.     #[ORM\OrderBy(['type' => 'ASC'])]
  44.     private Collection $rateTableAssignments;
  45.     public function __construct()
  46.     {
  47.         $this->overrides = new ArrayCollection();
  48.         $this->commissions = new ArrayCollection();
  49.         $this->rateTableAssignments = new ArrayCollection();
  50.     }
  51.     public function getId(): ?int
  52.     {
  53.         return $this->id;
  54.     }
  55.     public function getName(): ?string
  56.     {
  57.         return $this->name;
  58.     }
  59.     public function setName(string $name): self
  60.     {
  61.         $this->name $name;
  62.         return $this;
  63.     }
  64.     public function getAttainmentUnitType(): ?AttainmentUnitType
  65.     {
  66.         return $this->attainmentUnitType;
  67.     }
  68.     public function setAttainmentUnitType(AttainmentUnitType $attainmentUnitType): self
  69.     {
  70.         $this->attainmentUnitType $attainmentUnitType;
  71.         return $this;
  72.     }
  73.     public function getDescription(): ?string
  74.     {
  75.         return $this->description;
  76.     }
  77.     public function setDescription(?string $description): self
  78.     {
  79.         $this->description $description;
  80.         return $this;
  81.     }
  82.     public function getEffectiveStartDate(): ?\DateTimeInterface
  83.     {
  84.         return $this->effectiveStartDate;
  85.     }
  86.     public function setEffectiveStartDate(?\DateTimeInterface $effectiveStartDate): self
  87.     {
  88.         $this->effectiveStartDate $effectiveStartDate;
  89.         return $this;
  90.     }
  91.     public function getEffectiveEndDate(): ?\DateTimeInterface
  92.     {
  93.         return $this->effectiveEndDate;
  94.     }
  95.     public function setEffectiveEndDate(?\DateTimeInterface $effectiveEndDate): self
  96.     {
  97.         $this->effectiveEndDate $effectiveEndDate;
  98.         return $this;
  99.     }
  100.     public function __toString()
  101.     {
  102.         return (string)$this->name;
  103.     }
  104.     public function getParent(): ?self
  105.     {
  106.         return $this->parent;
  107.     }
  108.     public function setParent(?self $parent): self
  109.     {
  110.         $this->parent $parent;
  111.         return $this;
  112.     }
  113.     /**
  114.      * @return Collection<int, self>
  115.      */
  116.     public function getOverrides(): Collection
  117.     {
  118.         return $this->overrides;
  119.     }
  120.     public function addOverride(self $override): self
  121.     {
  122.         if (!$this->overrides->contains($override)) {
  123.             $this->overrides->add($override);
  124.             $override->setParent($this);
  125.         }
  126.         return $this;
  127.     }
  128.     public function removeOverride(self $override): self
  129.     {
  130.         if ($this->overrides->removeElement($override)) {
  131.             // set the owning side to null (unless already changed)
  132.             if ($override->getParent() === $this) {
  133.                 $override->setParent(null);
  134.             }
  135.         }
  136.         return $this;
  137.     }
  138.     public function getUser(): ?User
  139.     {
  140.         return $this->user;
  141.     }
  142.     public function setUser(?User $user): self
  143.     {
  144.         $this->user $user;
  145.         return $this;
  146.     }
  147.     public function getTitle(): ?Title
  148.     {
  149.         return $this->title;
  150.     }
  151.     public function setTitle(?Title $title): self
  152.     {
  153.         $this->title $title;
  154.         return $this;
  155.     }
  156.     public function getYear(): ?Year
  157.     {
  158.         return $this->year;
  159.     }
  160.     public function setYear(?Year $year): self
  161.     {
  162.         $this->year $year;
  163.         return $this;
  164.     }
  165.     public function getCreditType(): ?CreditType
  166.     {
  167.         return $this->creditType;
  168.     }
  169.     public function setCreditType(?CreditType $creditType): self
  170.     {
  171.         $this->creditType $creditType;
  172.         return $this;
  173.     }
  174.     /**
  175.      * @return Collection<int, Commission>
  176.      */
  177.     public function getCommissions(): Collection
  178.     {
  179.         return $this->commissions;
  180.     }
  181.     public function addCommission(Commission $commission): static
  182.     {
  183.         if (!$this->commissions->contains($commission)) {
  184.             $this->commissions->add($commission);
  185.             $commission->setRateTable($this);
  186.         }
  187.         return $this;
  188.     }
  189.     public function removeCommission(Commission $commission): static
  190.     {
  191.         if ($this->commissions->removeElement($commission)) {
  192.             // set the owning side to null (unless already changed)
  193.             if ($commission->getRateTable() === $this) {
  194.                 $commission->setRateTable(null);
  195.             }
  196.         }
  197.         return $this;
  198.     }
  199.     /**
  200.      * @return Collection<int, RateTableAssignment>
  201.      */
  202.     public function getRateTableAssignments(): Collection
  203.     {
  204.         return $this->rateTableAssignments;
  205.     }
  206.     public function addRateTableAssignment(RateTableAssignment $rateTableAssignment): static
  207.     {
  208.         if (!$this->rateTableAssignments->contains($rateTableAssignment)) {
  209.             $this->rateTableAssignments->add($rateTableAssignment);
  210.             $rateTableAssignment->setRateTable($this);
  211.         }
  212.         return $this;
  213.     }
  214.     public function removeRateTableAssignment(RateTableAssignment $rateTableAssignment): static
  215.     {
  216.         if ($this->rateTableAssignments->removeElement($rateTableAssignment)) {
  217.             // set the owning side to null (unless already changed)
  218.             if ($rateTableAssignment->getRateTable() === $this) {
  219.                 $rateTableAssignment->setRateTable(null);
  220.             }
  221.         }
  222.         return $this;
  223.     }
  224. }