src/Entity/Main/OpeningDays.php line 11

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Main;
  3. use App\Repository\Main\OpeningDaysRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. /**
  6.  * @ORM\Entity(repositoryClass=OpeningDaysRepository::class)
  7.  */
  8. class OpeningDays
  9. {
  10.     /**
  11.      * @ORM\Id
  12.      * @ORM\GeneratedValue
  13.      * @ORM\Column(type="integer")
  14.      */
  15.     private $id;
  16.     /**
  17.      * @ORM\Column(type="string", length=255)
  18.      */
  19.     private $day;
  20.     /**
  21.      * @ORM\Column(type="time")
  22.      */
  23.     private $opening_time;
  24.     /**
  25.      * @ORM\Column(type="time")
  26.      */
  27.     private $closing_time;
  28.     /**
  29.      * @ORM\Column(type="boolean")
  30.      */
  31.     private $is_holidays;
  32.     /**
  33.      * @ORM\Column(type="boolean")
  34.      */
  35.     private $is_public_holiday;
  36.     /**
  37.      * @ORM\ManyToOne(targetEntity=Activity::class, inversedBy="opening_days")
  38.      * @ORM\JoinColumn(nullable=true)
  39.      */
  40.     private $activity;
  41.     
  42.     public function __toString()
  43.     {
  44.         $label ucfirst($this->day);
  45.         if($this->isIsHolidays()) $label .= " [vacances]";
  46.         if($this->isIsPublicHoliday()) $label .= " [fériés]";
  47.         $label .= " | ";
  48.         $label .= $this->getOpeningTime()->format('H:i');
  49.         $label .= "-";
  50.         $label .= $this->getClosingTime()->format('H:i');
  51.         return (string) $label;
  52.     }
  53.     public function getId(): ?int
  54.     {
  55.         return $this->id;
  56.     }
  57.     public function getDay(): ?string
  58.     {
  59.         return $this->day;
  60.     }
  61.     public function setDay(string $day): self
  62.     {
  63.         $this->day $day;
  64.         return $this;
  65.     }
  66.     public function getOpeningTime(): ?\DateTimeInterface
  67.     {
  68.         return $this->opening_time;
  69.     }
  70.     public function setOpeningTime(\DateTimeInterface $opening_time): self
  71.     {
  72.         $this->opening_time $opening_time;
  73.         return $this;
  74.     }
  75.     public function getClosingTime(): ?\DateTimeInterface
  76.     {
  77.         return $this->closing_time;
  78.     }
  79.     public function setClosingTime(\DateTimeInterface $closing_time): self
  80.     {
  81.         $this->closing_time $closing_time;
  82.         return $this;
  83.     }
  84.     public function isIsHolidays(): ?bool
  85.     {
  86.         return $this->is_holidays;
  87.     }
  88.     public function setIsHolidays(bool $is_holidays): self
  89.     {
  90.         $this->is_holidays $is_holidays;
  91.         return $this;
  92.     }
  93.     public function isIsPublicHoliday(): ?bool
  94.     {
  95.         return $this->is_public_holiday;
  96.     }
  97.     public function setIsPublicHoliday(bool $is_public_holiday): self
  98.     {
  99.         $this->is_public_holiday $is_public_holiday;
  100.         return $this;
  101.     }
  102.     public function getActivity(): ?Activity
  103.     {
  104.         return $this->activity;
  105.     }
  106.     public function setActivity(?Activity $activity): self
  107.     {
  108.         $this->activity $activity;
  109.         return $this;
  110.     }
  111. }