src/Entity/Period.php line 15

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\PeriodRepository;
  4. use Doctrine\Common\Collections\Collection;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use App\Entity\Event;
  7. /**
  8.  * @ORM\Entity(repositoryClass=PeriodRepository::class)
  9.  */
  10. class Period
  11. {
  12.     /**
  13.      * @ORM\Id()
  14.      * @ORM\GeneratedValue()
  15.      * @ORM\Column(type="integer")
  16.      */
  17.     protected $id;
  18.     /**
  19.      * @ORM\Column(type="datetime", options={"default"="CURRENT_TIMESTAMP"})
  20.      */
  21.     private $periodStart;
  22.     /**
  23.      * @ORM\Column(type="datetime", nullable=true)
  24.      */
  25.     private $periodEnd;
  26.     /**
  27.      * @ORM\Column(type="boolean")
  28.      */
  29.     private $allDay;
  30.     /* relations */
  31.     
  32.     /**
  33.      * @ORM\ManyToOne(targetEntity="App\Entity\Event", inversedBy="periods", cascade={"persist"})
  34.      */
  35.     private $event;
  36.     
  37.     public function __construct()
  38.     {
  39.         $this->periodStart = new \DateTime();
  40.         $this->allDay = (bool) FALSE;
  41.     }
  42.     public function __toString()
  43.     {
  44.         return $this->periodStart->format("d/m/y H:i");
  45.     }
  46.     public function getId(): ?int
  47.     {
  48.         return $this->id;
  49.     }
  50.     public function getPeriodStart(): ?\DateTimeInterface
  51.     {
  52.         return $this->periodStart;
  53.     }
  54.     public function setPeriodStart(\DateTimeInterface $periodStart): self
  55.     {
  56.         $this->periodStart $periodStart;
  57.         return $this;
  58.     }
  59.     public function getPeriodEnd(): ?\DateTimeInterface
  60.     {
  61.         return $this->periodEnd;
  62.     }
  63.     public function setPeriodEnd(?\DateTimeInterface $periodEnd): self
  64.     {
  65.         $this->periodEnd $periodEnd;
  66.         return $this;
  67.     }
  68.     public function getAllDay(): ?bool
  69.     {
  70.         return $this->allDay;
  71.     }
  72.     public function setAllDay(?bool $allDay): self
  73.     {
  74.         $this->allDay $allDay;
  75.         return $this;
  76.     }
  77.     public function getEvent(): ?Event
  78.     {
  79.         return $this->event;
  80.     }
  81.     public function setEvent(?Event $event): self
  82.     {
  83.         $this->event $event;
  84.         return $this;
  85.     }
  86. }