src/Entity/Periode.php line 16

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Entity\Traits\TimeStampable;
  4. use App\Repository\PeriodeRepository;
  5. use Carbon\Traits\Timestamp;
  6. use Doctrine\Common\Collections\ArrayCollection;
  7. use Doctrine\Common\Collections\Collection;
  8. use Doctrine\DBAL\Types\Types;
  9. use Doctrine\ORM\Mapping as ORM;
  10. use Symfony\Component\Serializer\Annotation\Groups;
  11. #[ORM\Entity(repositoryClass: PeriodeRepository::class)]
  12. #[ORM\HasLifecycleCallbacks]
  13. class Periode
  14. {
  15.     use TimeStampable;
  16.     
  17.     #[ORM\Id]
  18.     #[ORM\GeneratedValue]
  19.     #[ORM\Column]
  20.     #[Groups(["entity:write"])]
  21.     private ?int $id = null;
  22.     #[ORM\Column(length: 255)]
  23.     #[Groups(["entity:write"])]
  24.     private ?string $name = null;
  25.     #[ORM\Column(type: Types::DATE_MUTABLE)]
  26.     #[Groups(["entity:write"])]
  27.     private ?\DateTimeInterface $dateDebut = null;
  28.     #[ORM\Column(type: Types::DATE_MUTABLE)]
  29.     #[Groups(["entity:write"])]
  30.     private ?\DateTimeInterface $dateFin = null; 
  31.     public function  __construct()
  32.     {
  33.         $this->createdAt = new \DateTimeImmutable();
  34.     }
  35.     public function getId(): ?int
  36.     {
  37.         return $this->id;
  38.     }
  39.     public function getName(): ?string
  40.     {
  41.         return $this->name;
  42.     }
  43.     public function setName(string $name): static
  44.     {
  45.         $this->name = $name;
  46.         return $this;
  47.     }
  48.     public function getDateDebut(): ?\DateTimeInterface
  49.     {
  50.         return $this->dateDebut;
  51.     }
  52.     public function setDateDebut(\DateTimeInterface $dateDebut): static
  53.     {
  54.         $this->dateDebut = $dateDebut;
  55.         return $this;
  56.     }
  57.     public function getDateFin(): ?\DateTimeInterface
  58.     {
  59.         return $this->dateFin;
  60.     }
  61.     public function setDateFin(\DateTimeInterface $dateFin): static
  62.     {
  63.         $this->dateFin = $dateFin;
  64.         return $this;
  65.     }
  66.     
  67.     public function __toString() {
  68.         return $this->name;
  69.     }
  70. }