src/Flexy/ShopBundle/Entity/Accounting/FinancialYear.php line 14

  1. <?php
  2. namespace App\Flexy\ShopBundle\Entity\Accounting;
  3. use ApiPlatform\Metadata\ApiResource;
  4. use App\Repository\Flexy\ShopBundle\Entity\Accounting\FinancialYearRepository;
  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. #[ORM\Entity(repositoryClassFinancialYearRepository::class)]
  10. #[ApiResource]
  11. class FinancialYear
  12. {
  13.     #[ORM\Id]
  14.     #[ORM\GeneratedValue]
  15.     #[ORM\Column]
  16.     private ?int $id null;
  17.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  18.     private ?string $description null;
  19.     #[ORM\Column(typeTypes::DATETIME_MUTABLEnullabletrue)]
  20.     private ?\DateTimeInterface $createdAt null;
  21.     #[ORM\Column(typeTypes::DATE_MUTABLEnullabletrue)]
  22.     private ?\DateTimeInterface $year null;
  23.     #[ORM\Column(typeTypes::DATETIME_MUTABLE)]
  24.     private ?\DateTimeInterface $startAt null;
  25.     #[ORM\Column(typeTypes::DATETIME_MUTABLE)]
  26.     private ?\DateTimeInterface $endAt null;
  27.     #[ORM\OneToMany(mappedBy'financialYear'targetEntityFinancialPeriod::class, orphanRemovaltrue)]
  28.     private Collection $financialPeriods;
  29.     public function __construct()
  30.     {
  31.         $this->financialPeriods = new ArrayCollection();
  32.     }
  33.     public function getId(): ?int
  34.     {
  35.         return $this->id;
  36.     }
  37.     public function getDescription(): ?string
  38.     {
  39.         return $this->description;
  40.     }
  41.     public function setDescription(?string $description): self
  42.     {
  43.         $this->description $description;
  44.         return $this;
  45.     }
  46.     public function getCreatedAt(): ?\DateTimeInterface
  47.     {
  48.         return $this->createdAt;
  49.     }
  50.     public function setCreatedAt(?\DateTimeInterface $createdAt): self
  51.     {
  52.         $this->createdAt $createdAt;
  53.         return $this;
  54.     }
  55.     public function getYear(): ?\DateTimeInterface
  56.     {
  57.         return $this->year;
  58.     }
  59.     public function setYear(?\DateTimeInterface $year): self
  60.     {
  61.         $this->year $year;
  62.         return $this;
  63.     }
  64.     public function getStartAt(): ?\DateTimeInterface
  65.     {
  66.         return $this->startAt;
  67.     }
  68.     public function setStartAt(\DateTimeInterface $startAt): self
  69.     {
  70.         $this->startAt $startAt;
  71.         return $this;
  72.     }
  73.     public function getEndAt(): ?\DateTimeInterface
  74.     {
  75.         return $this->endAt;
  76.     }
  77.     public function setEndAt(\DateTimeInterface $endAt): self
  78.     {
  79.         $this->endAt $endAt;
  80.         return $this;
  81.     }
  82.     /**
  83.      * @return Collection<int, FinancialPeriod>
  84.      */
  85.     public function getFinancialPeriods(): Collection
  86.     {
  87.         return $this->financialPeriods;
  88.     }
  89.     public function addFinancialPeriod(FinancialPeriod $financialPeriod): self
  90.     {
  91.         if (!$this->financialPeriods->contains($financialPeriod)) {
  92.             $this->financialPeriods->add($financialPeriod);
  93.             $financialPeriod->setFinancialYear($this);
  94.         }
  95.         return $this;
  96.     }
  97.     public function removeFinancialPeriod(FinancialPeriod $financialPeriod): self
  98.     {
  99.         if ($this->financialPeriods->removeElement($financialPeriod)) {
  100.             // set the owning side to null (unless already changed)
  101.             if ($financialPeriod->getFinancialYear() === $this) {
  102.                 $financialPeriod->setFinancialYear(null);
  103.             }
  104.         }
  105.         return $this;
  106.     }
  107. }