<?phpnamespace App\Entity;use App\Repository\PeriodRepository;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;use App\Entity\Event;/** * @ORM\Entity(repositoryClass=PeriodRepository::class) */class Period{ /** * @ORM\Id() * @ORM\GeneratedValue() * @ORM\Column(type="integer") */ protected $id; /** * @ORM\Column(type="datetime", options={"default"="CURRENT_TIMESTAMP"}) */ private $periodStart; /** * @ORM\Column(type="datetime", nullable=true) */ private $periodEnd; /** * @ORM\Column(type="boolean") */ private $allDay; /* relations */ /** * @ORM\ManyToOne(targetEntity="App\Entity\Event", inversedBy="periods", cascade={"persist"}) */ private $event; public function __construct() { $this->periodStart = new \DateTime(); $this->allDay = (bool) FALSE; } public function __toString() { return $this->periodStart->format("d/m/y H:i"); } public function getId(): ?int { return $this->id; } public function getPeriodStart(): ?\DateTimeInterface { return $this->periodStart; } public function setPeriodStart(\DateTimeInterface $periodStart): self { $this->periodStart = $periodStart; return $this; } public function getPeriodEnd(): ?\DateTimeInterface { return $this->periodEnd; } public function setPeriodEnd(?\DateTimeInterface $periodEnd): self { $this->periodEnd = $periodEnd; return $this; } public function getAllDay(): ?bool { return $this->allDay; } public function setAllDay(?bool $allDay): self { $this->allDay = $allDay; return $this; } public function getEvent(): ?Event { return $this->event; } public function setEvent(?Event $event): self { $this->event = $event; return $this; }}