src/Entity/Common/DateInterval.php line 9

  1. <?php
  2. namespace App\Entity\Common;
  3. use DateTime;
  4. use Doctrine\ORM\Mapping as ORM;
  5. #[ORM\Embeddable]
  6. class DateInterval implements DateTimeIntervalInterface
  7. {
  8.     #[ORM\Column(type'date'nullabletrue)]
  9.     private ?DateTime $from null;
  10.     /**
  11.      * @var  DateTime|null
  12.      */
  13.     #[ORM\Column(type'date'nullabletrue)]
  14.     private ?DateTime $to null;
  15.     public function getFrom(): ?DateTime
  16.     {
  17.         return $this->from;
  18.     }
  19.     public function setFrom(?DateTime $from): void
  20.     {
  21.         $this->from $from;
  22.     }
  23.     public function getTo(): ?DateTime
  24.     {
  25.         return $this->to;
  26.     }
  27.     public function setTo(?DateTime $to): void
  28.     {
  29.         $this->to $to;
  30.     }
  31.     public function isEmpty():bool{
  32.         return is_null($this->from) && is_null($this->to);
  33.     }
  34. }