src/Entity/Planning.php line 10

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\PlanningRepository;
  4. use Doctrine\DBAL\Types\Types;
  5. use Doctrine\ORM\Mapping as ORM;
  6. #[ORM\Entity(repositoryClassPlanningRepository::class)]
  7. class Planning
  8. {
  9.     #[ORM\Id]
  10.     #[ORM\GeneratedValue]
  11.     #[ORM\Column]
  12.     private ?int $id null;
  13.     private string $firstWeekRange;
  14.     private string $secondWeekRange;
  15.     #[ORM\Column(typeTypes::DATE_MUTABLE)]
  16.     private ?\DateTimeInterface $firstWeekStart null;
  17.     #[ORM\Column(typeTypes::DATE_MUTABLE)]
  18.     private ?\DateTimeInterface $firstWeekEnd null;
  19.     #[ORM\Column(typeTypes::DATE_MUTABLE)]
  20.     private ?\DateTimeInterface $secondWeekStart null;
  21.     #[ORM\Column(typeTypes::DATE_MUTABLE)]
  22.     private ?\DateTimeInterface $secondWeekEnd null;
  23.     private ?array $firstFile null;
  24.     private ?array $secondFile null;
  25.     private ?array $directory null;
  26.     public function getId(): ?int
  27.     {
  28.         return $this->id;
  29.     }
  30.     public function getFirstWeekStart(): ?\DateTimeInterface
  31.     {
  32.         return $this->firstWeekStart;
  33.     }
  34.     public function getFirstWeekStartFormat(): ?string
  35.     {
  36.         return $this->firstWeekStart->format('d-m');
  37.     }
  38.     public function setFirstWeekStart(\DateTimeInterface $firstWeekStart): self
  39.     {
  40.         $this->firstWeekStart $firstWeekStart;
  41.         return $this;
  42.     }
  43.     public function getSecondWeekStart(): ?\DateTimeInterface
  44.     {
  45.         return $this->secondWeekStart;
  46.     }
  47.     public function getSecondWeekStartFormat(): ?string
  48.     {
  49.         return $this->secondWeekStart->format('d-m');
  50.     }
  51.     public function setSecondWeekStart(\DateTimeInterface $secondWeekStart): self
  52.     {
  53.         $this->secondWeekStart $secondWeekStart;
  54.         return $this;
  55.     }
  56.     public function getFirstWeekEnd(): ?\DateTimeInterface
  57.     {
  58.         return $this->firstWeekEnd;
  59.     }
  60.     public function getFirstWeekEndFormat(): ?string
  61.     {
  62.         return $this->firstWeekEnd->format('d-m');
  63.     }
  64.     public function setFirstWeekEnd(\DateTimeInterface $firstWeekEnd): self
  65.     {
  66.         $this->firstWeekEnd $firstWeekEnd;
  67.         return $this;
  68.     }
  69.     public function getSecondWeekEnd(): ?\DateTimeInterface
  70.     {
  71.         return $this->secondWeekEnd;
  72.     }
  73.     public function getSecondWeekEndFormat(): ?string
  74.     {
  75.         return $this->secondWeekEnd->format('d-m');
  76.     }
  77.     public function setSecondWeekEnd(\DateTimeInterface $secondWeekEnd): self
  78.     {
  79.         $this->secondWeekEnd $secondWeekEnd;
  80.         return $this;
  81.     }
  82.     public function setFirstWeekRange(string $firstWeekRange) {
  83.         $this->firstWeekRange $firstWeekRange;
  84.         if ($firstWeekRange != null) {
  85.             $matches = [];
  86.             preg_match'/([0-9]{2}\/[0-9]{2}\/[0-9]{4}) - ([0-9]{2}\/[0-9]{2}\/[0-9]{4})/'$firstWeekRange$matches);
  87.             $this->firstWeekStart = new \DateTime($matches[1]);
  88.             $this->firstWeekEnd =  new \DateTime($matches[2]);
  89.         }
  90.         return $this;
  91.     }
  92.     public function getFirstWeekRange() {
  93.         if ($this->firstWeekStart && $this->firstWeekEnd) {
  94.             return $this->firstWeekStart->format('m-d-Y').' - '.$this->firstWeekEnd->format('m-d-Y');
  95.         }
  96.         return $this->firstWeekRange;
  97.     }
  98.     public function setSecondWeekRange(string $secondWeekRange) {
  99.         $this->secondWeekRange $secondWeekRange;
  100.         if ($this->secondWeekRange != null) {
  101.             $matches = [];
  102.             preg_match'/([0-9]{2}\/[0-9]{2}\/[0-9]{4}) - ([0-9]{2}\/[0-9]{2}\/[0-9]{4})/'$secondWeekRange$matches);
  103.             $this->secondWeekStart = new \DateTime($matches[1]);
  104.             $this->secondWeekEnd =  new \DateTime($matches[2]);
  105.         }
  106.         return $this;
  107.     }
  108.     public function getSecondWeekRange() {
  109.         if ($this->secondWeekStart && $this->secondWeekEnd) {
  110.             return $this->secondWeekStart->format('m-d-Y').' - '.$this->secondWeekEnd->format('m-d-Y');
  111.         }
  112.         return $this->secondWeekRange;
  113.     }
  114.     public function getFirstFile(): ?array
  115.     {
  116.         return $this->firstFile;
  117.     }
  118.     public function setFirstFile(?array $firstFile): self
  119.     {
  120.         $this->firstFile $firstFile;
  121.         return $this;
  122.     }
  123.     public function getSecondFile(): ?array
  124.     {
  125.         return $this->secondFile;
  126.     }
  127.     public function setSecondFile(array $secondFile): self
  128.     {
  129.         $this->secondFile $secondFile;
  130.         return $this;
  131.     }
  132.     public function getDirectory(): ?array
  133.     {
  134.         return $this->directory;
  135.     }
  136.     public function setDirectory(?array $directory): self
  137.     {
  138.         $this->directory $directory;
  139.         return $this;
  140.     }
  141. }