src/Entity/QuotaTier.php line 13
<?phpnamespace App\Entity;use App\Enum\QuotaTierPeriod;use App\Repository\QuotaPeriodRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;use Gedmo\Timestampable\Traits\TimestampableEntity;#[ORM\Entity(repositoryClass: QuotaPeriodRepository::class)]class QuotaTier{use TimestampableEntity;#[ORM\Id]#[ORM\GeneratedValue]#[ORM\Column]private ?int $id = null;#[ORM\Column(length: 255)]private ?string $name = null;#[ORM\ManyToOne(inversedBy: 'quotaTiers')]private ?Quota $quota = null;#[ORM\ManyToOne(targetEntity: self::class, inversedBy: 'children')]private ?self $parent = null;#[ORM\OneToMany(mappedBy: 'parent', targetEntity: self::class, cascade: ['persist', 'remove'])]private Collection $children;#[ORM\Column]private ?float $amount = null;#[ORM\Column(length: 255, enumType: QuotaTierPeriod::class)]private ?QuotaTierPeriod $period = null;#[ORM\ManyToOne(inversedBy: 'quotaTiers')]#[ORM\JoinColumn(nullable: false)]private ?Year $year = null;public function __construct(){$this->children = new ArrayCollection();}public function getId(): ?int{return $this->id;}public function getName(): ?string{return $this->name;}public function setName(string $name): self{$this->name = $name;return $this;}public function getQuota(): ?Quota{return $this->quota;}public function setQuota(?Quota $quota): self{$this->quota = $quota;return $this;}public function getParent(): ?self{return $this->parent;}public function setParent(?self $parent): self{$this->parent = $parent;return $this;}/*** @return Collection<int, self>*/public function getChildren(): Collection{return $this->children;}public function setChildren(): self{$debug = 0;}public function addChild(self $child): self{if (!$this->children->contains($child)) {$this->children->add($child);$child->setParent($this);}return $this;}public function removeChild(self $child): self{if ($this->children->removeElement($child)) {// set the owning side to null (unless already changed)if ($child->getParent() === $this) {$child->setParent(null);}}return $this;}public function getAmount(): ?float{return $this->amount;}public function setAmount(float $amount): self{$this->amount = $amount;return $this;}public function __toString(){$check = $this;while(!$check->getQuota()) {$check = $check->getParent();}return $check->getQuota()->getName() . ' - ' . $this->getName();}public function getPeriod(): ?QuotaTierPeriod{return $this->period;}public function setPeriod(?QuotaTierPeriod $period): self{$this->period = $period;return $this;}public function getYear(): ?Year{return $this->year;}public function setYear(?Year $year): self{$this->year = $year;return $this;}}