src/Flexy/ShopBundle/Entity/Accounting/FinancialYear.php line 14
<?php
namespace App\Flexy\ShopBundle\Entity\Accounting;
use ApiPlatform\Metadata\ApiResource;
use App\Repository\Flexy\ShopBundle\Entity\Accounting\FinancialYearRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: FinancialYearRepository::class)]
#[ApiResource]
class FinancialYear
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $description = null;
#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]
private ?\DateTimeInterface $createdAt = null;
#[ORM\Column(type: Types::DATE_MUTABLE, nullable: true)]
private ?\DateTimeInterface $year = null;
#[ORM\Column(type: Types::DATETIME_MUTABLE)]
private ?\DateTimeInterface $startAt = null;
#[ORM\Column(type: Types::DATETIME_MUTABLE)]
private ?\DateTimeInterface $endAt = null;
#[ORM\OneToMany(mappedBy: 'financialYear', targetEntity: FinancialPeriod::class, orphanRemoval: true)]
private Collection $financialPeriods;
public function __construct()
{
$this->financialPeriods = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(?string $description): self
{
$this->description = $description;
return $this;
}
public function getCreatedAt(): ?\DateTimeInterface
{
return $this->createdAt;
}
public function setCreatedAt(?\DateTimeInterface $createdAt): self
{
$this->createdAt = $createdAt;
return $this;
}
public function getYear(): ?\DateTimeInterface
{
return $this->year;
}
public function setYear(?\DateTimeInterface $year): self
{
$this->year = $year;
return $this;
}
public function getStartAt(): ?\DateTimeInterface
{
return $this->startAt;
}
public function setStartAt(\DateTimeInterface $startAt): self
{
$this->startAt = $startAt;
return $this;
}
public function getEndAt(): ?\DateTimeInterface
{
return $this->endAt;
}
public function setEndAt(\DateTimeInterface $endAt): self
{
$this->endAt = $endAt;
return $this;
}
/**
* @return Collection<int, FinancialPeriod>
*/
public function getFinancialPeriods(): Collection
{
return $this->financialPeriods;
}
public function addFinancialPeriod(FinancialPeriod $financialPeriod): self
{
if (!$this->financialPeriods->contains($financialPeriod)) {
$this->financialPeriods->add($financialPeriod);
$financialPeriod->setFinancialYear($this);
}
return $this;
}
public function removeFinancialPeriod(FinancialPeriod $financialPeriod): self
{
if ($this->financialPeriods->removeElement($financialPeriod)) {
// set the owning side to null (unless already changed)
if ($financialPeriod->getFinancialYear() === $this) {
$financialPeriod->setFinancialYear(null);
}
}
return $this;
}
}