<?phpnamespace App\Entity\Kpi;use App\Entity\Adherent\Magasin;use App\Repository\Kpi\KpiParametersRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\DBAL\Types\Types;use Doctrine\ORM\Mapping as ORM;use App\Validator as Assert;#[ORM\Entity(repositoryClass: KpiParametersRepository::class)]#[UniqueEntity( fields: ['magasin', 'status'], errorPath: 'status', message: 'Un magasin ne peut avoir qu\'un seul exercice en cours', conditions: ['status' => 'EN_COURS'])]class KpiParameters{ #[ORM\Id] #[ORM\GeneratedValue] #[ORM\Column] private ?int $id = null; #[ORM\Column(type: 'date')] #[Assert\NotNull(message: 'La date de début est obligatoire')] private ?\DateTimeInterface $startExercice = null; #[ORM\Column(type: 'date')] #[Assert\NotNull(message: 'La date de fin est obligatoire')] private ?\DateTimeInterface $endExercice = null; #[ORM\Column] private ?\DateTimeImmutable $createdAt = null; #[ORM\Column(nullable: true)] private ?\DateTimeImmutable $updatedAt = null; #[ORM\ManyToOne(inversedBy: 'exercices')] #[ORM\JoinColumn(name: 'magasin', referencedColumnName: 'k_adherent', nullable: false)] private ?Magasin $magasin = null; #[ORM\Column(length: 20)] private string $status = 'EN_COURS'; // EN_COURS / TERMINE #[ORM\OneToOne(mappedBy: 'exercice', cascade: ['persist', 'remove'])] private ?KpiObjectifs $objectifs = null; public function __construct() { $this->createdAt = new \DateTimeImmutable(); } public function getId(): ?int { return $this->id; } public function getStartExercice(): ?\DateTimeInterface { return $this->startExercice; } public function setStartExercice(\DateTimeInterface $startExercice): self { $this->startExercice = $startExercice; return $this; } public function getEndExercice(): ?\DateTimeInterface { return $this->endExercice; } public function setEndExercice(\DateTimeInterface $endExercice): self { $this->endExercice = $endExercice; return $this; } public function getCreatedAt(): ?\DateTimeImmutable { return $this->createdAt; } public function setCreatedAt(\DateTimeImmutable $createdAt): self { $this->createdAt = $createdAt; return $this; } public function getUpdatedAt(): ?\DateTimeImmutable { return $this->updatedAt; } public function setUpdatedAt(?\DateTimeImmutable $updatedAt): self { $this->updatedAt = $updatedAt; return $this; } public function getMagasin(): ?Magasin { return $this->magasin; } public function setMagasin(Magasin $magasin): self { $this->magasin = $magasin; return $this; } public function getStatus(): string { return $this->status; } public function setStatus(string $status): void { $this->status = $status; } public function getObjectifs(): ?KpiObjectifs { return $this->objectifs; } public function setObjectifs(?KpiObjectifs $objectifs): self { $this->objectifs = $objectifs; return $this; }}