src/Entity/CreditType.php line 12

  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\CreditTypeRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Gedmo\Timestampable\Traits\TimestampableEntity;
  8. #[ORM\Entity(repositoryClassCreditTypeRepository::class)]
  9. class CreditType
  10. {
  11.     use TimestampableEntity;
  12.     #[ORM\Id]
  13.     #[ORM\GeneratedValue]
  14.     #[ORM\Column]
  15.     private ?int $id null;
  16.     #[ORM\Column(length255)]
  17.     private ?string $name null;
  18.     #[ORM\Column(length255nullabletrue)]
  19.     private ?string $description null;
  20.     #[ORM\ManyToOne(inversedBy'creditTypes')]
  21.     private ?Year $year null;
  22.     #[ORM\OneToMany(mappedBy'creditType'targetEntityRuleCondition::class)]
  23.     private Collection $ruleConditions;
  24.     #[ORM\OneToMany(mappedBy'creditType'targetEntityRuleResult::class)]
  25.     private Collection $ruleResults;
  26.     #[ORM\OneToMany(mappedBy'creditType'targetEntityCredit::class)]
  27.     private Collection $credits;
  28.     #[ORM\Column]
  29.     private ?bool $incentiveStatement false;
  30.     #[ORM\ManyToMany(targetEntityAttainmentMeasure::class, mappedBy'creditTypes')]
  31.     private Collection $attainmentMeasures;
  32.     public function __construct()
  33.     {
  34.         $this->ruleConditions = new ArrayCollection();
  35.         $this->ruleResults = new ArrayCollection();
  36.         $this->credits = new ArrayCollection();
  37.         $this->attainmentMeasures = new ArrayCollection();
  38.     }
  39.     public function getId(): ?int
  40.     {
  41.         return $this->id;
  42.     }
  43.     public function getName(): ?string
  44.     {
  45.         return $this->name;
  46.     }
  47.     public function setName(string $name): self
  48.     {
  49.         $this->name $name;
  50.         return $this;
  51.     }
  52.     public function getDescription(): ?string
  53.     {
  54.         return $this->description;
  55.     }
  56.     public function setDescription(?string $description): self
  57.     {
  58.         $this->description $description;
  59.         return $this;
  60.     }
  61.     public function __toString(): string
  62.     {
  63.         return (string)$this->name;
  64.     }
  65.     public function getYear(): ?Year
  66.     {
  67.         return $this->year;
  68.     }
  69.     public function setYear(?Year $year): self
  70.     {
  71.         $this->year $year;
  72.         return $this;
  73.     }
  74.     /**
  75.      * @return Collection<int, RuleCondition>
  76.      */
  77.     public function getRuleConditions(): Collection
  78.     {
  79.         return $this->ruleConditions;
  80.     }
  81.     public function addRuleCondition(RuleCondition $ruleCondition): self
  82.     {
  83.         if (!$this->ruleConditions->contains($ruleCondition)) {
  84.             $this->ruleConditions->add($ruleCondition);
  85.             $ruleCondition->setCreditType($this);
  86.         }
  87.         return $this;
  88.     }
  89.     public function removeRuleCondition(RuleCondition $ruleCondition): self
  90.     {
  91.         if ($this->ruleConditions->removeElement($ruleCondition)) {
  92.             // set the owning side to null (unless already changed)
  93.             if ($ruleCondition->getCreditType() === $this) {
  94.                 $ruleCondition->setCreditType(null);
  95.             }
  96.         }
  97.         return $this;
  98.     }
  99.     /**
  100.      * @return Collection<int, RuleResult>
  101.      */
  102.     public function getRuleResults(): Collection
  103.     {
  104.         return $this->ruleResults;
  105.     }
  106.     public function addRuleResult(RuleResult $ruleResult): static
  107.     {
  108.         if (!$this->ruleResults->contains($ruleResult)) {
  109.             $this->ruleResults->add($ruleResult);
  110.             $ruleResult->setCreditType($this);
  111.         }
  112.         return $this;
  113.     }
  114.     public function removeRuleResult(RuleResult $ruleResult): static
  115.     {
  116.         if ($this->ruleResults->removeElement($ruleResult)) {
  117.             // set the owning side to null (unless already changed)
  118.             if ($ruleResult->getCreditType() === $this) {
  119.                 $ruleResult->setCreditType(null);
  120.             }
  121.         }
  122.         return $this;
  123.     }
  124.     /**
  125.      * @return Collection<int, Credit>
  126.      */
  127.     public function getCredits(): Collection
  128.     {
  129.         return $this->credits;
  130.     }
  131.     public function addCredit(Credit $credit): static
  132.     {
  133.         if (!$this->credits->contains($credit)) {
  134.             $this->credits->add($credit);
  135.             $credit->setCreditType($this);
  136.         }
  137.         return $this;
  138.     }
  139.     public function removeCredit(Credit $credit): static
  140.     {
  141.         if ($this->credits->removeElement($credit)) {
  142.             // set the owning side to null (unless already changed)
  143.             if ($credit->getCreditType() === $this) {
  144.                 $credit->setCreditType(null);
  145.             }
  146.         }
  147.         return $this;
  148.     }
  149.     public function isIncentiveStatement(): ?bool
  150.     {
  151.         return $this->incentiveStatement;
  152.     }
  153.     public function setIncentiveStatement(bool $incentiveStatement): static
  154.     {
  155.         $this->incentiveStatement $incentiveStatement;
  156.         return $this;
  157.     }
  158.     public function getAttainmentMeasures(): Collection
  159.     {
  160.         return $this->attainmentMeasures;
  161.     }
  162.     public function addAttainmentMeasure(AttainmentMeasure $attainmentMeasure): self
  163.     {
  164.         if (!$this->attainmentMeasures->contains($attainmentMeasure)) {
  165.             $this->attainmentMeasures[] = $attainmentMeasure;
  166.             $attainmentMeasure->addCreditType($this);
  167.         }
  168.         return $this;
  169.     }
  170.     public function removeAttainmentMeasure(AttainmentMeasure $attainmentMeasure): self
  171.     {
  172.         if ($this->attainmentMeasures->removeElement($attainmentMeasure)) {
  173.             $attainmentMeasure->removeCreditType($this);
  174.         }
  175.         return $this;
  176.     }
  177. }