<?php
namespace App\Entity;
use App\Entity\Traits\TimeStampable;
use App\Repository\PeriodeRepository;
use Carbon\Traits\Timestamp;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation\Groups;
#[ORM\Entity(repositoryClass: PeriodeRepository::class)]
#[ORM\HasLifecycleCallbacks]
class Periode
{
use TimeStampable;
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
#[Groups(["entity:write"])]
private ?int $id = null;
#[ORM\Column(length: 255)]
#[Groups(["entity:write"])]
private ?string $name = null;
#[ORM\Column(type: Types::DATE_MUTABLE)]
#[Groups(["entity:write"])]
private ?\DateTimeInterface $dateDebut = null;
#[ORM\Column(type: Types::DATE_MUTABLE)]
#[Groups(["entity:write"])]
private ?\DateTimeInterface $dateFin = null;
public function __construct()
{
$this->createdAt = new \DateTimeImmutable();
}
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): static
{
$this->name = $name;
return $this;
}
public function getDateDebut(): ?\DateTimeInterface
{
return $this->dateDebut;
}
public function setDateDebut(\DateTimeInterface $dateDebut): static
{
$this->dateDebut = $dateDebut;
return $this;
}
public function getDateFin(): ?\DateTimeInterface
{
return $this->dateFin;
}
public function setDateFin(\DateTimeInterface $dateFin): static
{
$this->dateFin = $dateFin;
return $this;
}
public function __toString() {
return $this->name;
}
}