src/Entity/Kpi/KpiParameters.php line 21

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Kpi;
  3. use App\Entity\Adherent\Magasin;
  4. use App\Repository\Kpi\KpiParametersRepository;
  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. use App\Validator as Assert;
  10. #[ORM\Entity(repositoryClassKpiParametersRepository::class)]
  11. #[UniqueEntity(
  12.     fields: ['magasin''status'],
  13.     errorPath'status',
  14.     message'Un magasin ne peut avoir qu\'un seul exercice en cours',
  15.     conditions: ['status' => 'EN_COURS']
  16. )]
  17. class KpiParameters
  18. {
  19.     #[ORM\Id]
  20.     #[ORM\GeneratedValue]
  21.     #[ORM\Column]
  22.     private ?int $id null;
  23.     #[ORM\Column(type'date')]
  24.     #[Assert\NotNull(message'La date de début est obligatoire')]
  25.     private ?\DateTimeInterface $startExercice null;
  26.     #[ORM\Column(type'date')]
  27.     #[Assert\NotNull(message'La date de fin est obligatoire')]
  28.     private ?\DateTimeInterface $endExercice null;
  29.     #[ORM\Column]
  30.     private ?\DateTimeImmutable $createdAt null;
  31.     #[ORM\Column(nullabletrue)]
  32.     private ?\DateTimeImmutable $updatedAt null;
  33.     #[ORM\ManyToOne(inversedBy'exercices')]
  34.     #[ORM\JoinColumn(name'magasin'referencedColumnName'k_adherent'nullablefalse)]
  35.     private ?Magasin $magasin null;
  36.     #[ORM\Column(length20)]
  37.     private string $status 'EN_COURS'// EN_COURS / TERMINE
  38.     #[ORM\OneToOne(mappedBy'exercice'cascade: ['persist''remove'])]
  39.     private ?KpiObjectifs $objectifs null;
  40.     public function __construct()
  41.     {
  42.         $this->createdAt = new \DateTimeImmutable();
  43.     }
  44.     public function getId(): ?int
  45.     {
  46.         return $this->id;
  47.     }
  48.     public function getStartExercice(): ?\DateTimeInterface
  49.     {
  50.         return $this->startExercice;
  51.     }
  52.     public function setStartExercice(\DateTimeInterface $startExercice): self
  53.     {
  54.         $this->startExercice $startExercice;
  55.         return $this;
  56.     }
  57.     public function getEndExercice(): ?\DateTimeInterface
  58.     {
  59.         return $this->endExercice;
  60.     }
  61.     public function setEndExercice(\DateTimeInterface $endExercice): self
  62.     {
  63.         $this->endExercice $endExercice;
  64.         return $this;
  65.     }
  66.     public function getCreatedAt(): ?\DateTimeImmutable
  67.     {
  68.         return $this->createdAt;
  69.     }
  70.     public function setCreatedAt(\DateTimeImmutable $createdAt): self
  71.     {
  72.         $this->createdAt $createdAt;
  73.         return $this;
  74.     }
  75.     public function getUpdatedAt(): ?\DateTimeImmutable
  76.     {
  77.         return $this->updatedAt;
  78.     }
  79.     public function setUpdatedAt(?\DateTimeImmutable $updatedAt): self
  80.     {
  81.         $this->updatedAt $updatedAt;
  82.         return $this;
  83.     }
  84.     public function getMagasin(): ?Magasin
  85.     {
  86.         return $this->magasin;
  87.     }
  88.     public function setMagasin(Magasin $magasin): self
  89.     {
  90.         $this->magasin $magasin;
  91.         return $this;
  92.     }
  93.     public function getStatus(): string
  94.     {
  95.         return $this->status;
  96.     }
  97.     public function setStatus(string $status): void
  98.     {
  99.         $this->status $status;
  100.     }
  101.     public function getObjectifs(): ?KpiObjectifs
  102.     {
  103.         return $this->objectifs;
  104.     }
  105.     public function setObjectifs(?KpiObjectifs $objectifs): self
  106.     {
  107.         $this->objectifs $objectifs;
  108.         return $this;
  109.     }
  110. }