<?php
namespace App\Entity;
use App\Repository\PlanningRepository;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: PlanningRepository::class)]
class Planning
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
private string $firstWeekRange;
private string $secondWeekRange;
#[ORM\Column(type: Types::DATE_MUTABLE)]
private ?\DateTimeInterface $firstWeekStart = null;
#[ORM\Column(type: Types::DATE_MUTABLE)]
private ?\DateTimeInterface $firstWeekEnd = null;
#[ORM\Column(type: Types::DATE_MUTABLE)]
private ?\DateTimeInterface $secondWeekStart = null;
#[ORM\Column(type: Types::DATE_MUTABLE)]
private ?\DateTimeInterface $secondWeekEnd = null;
private ?array $firstFile = null;
private ?array $secondFile = null;
private ?array $directory = null;
public function getId(): ?int
{
return $this->id;
}
public function getFirstWeekStart(): ?\DateTimeInterface
{
return $this->firstWeekStart;
}
public function getFirstWeekStartFormat(): ?string
{
return $this->firstWeekStart->format('d-m');
}
public function setFirstWeekStart(\DateTimeInterface $firstWeekStart): self
{
$this->firstWeekStart = $firstWeekStart;
return $this;
}
public function getSecondWeekStart(): ?\DateTimeInterface
{
return $this->secondWeekStart;
}
public function getSecondWeekStartFormat(): ?string
{
return $this->secondWeekStart->format('d-m');
}
public function setSecondWeekStart(\DateTimeInterface $secondWeekStart): self
{
$this->secondWeekStart = $secondWeekStart;
return $this;
}
public function getFirstWeekEnd(): ?\DateTimeInterface
{
return $this->firstWeekEnd;
}
public function getFirstWeekEndFormat(): ?string
{
return $this->firstWeekEnd->format('d-m');
}
public function setFirstWeekEnd(\DateTimeInterface $firstWeekEnd): self
{
$this->firstWeekEnd = $firstWeekEnd;
return $this;
}
public function getSecondWeekEnd(): ?\DateTimeInterface
{
return $this->secondWeekEnd;
}
public function getSecondWeekEndFormat(): ?string
{
return $this->secondWeekEnd->format('d-m');
}
public function setSecondWeekEnd(\DateTimeInterface $secondWeekEnd): self
{
$this->secondWeekEnd = $secondWeekEnd;
return $this;
}
public function setFirstWeekRange(string $firstWeekRange) {
$this->firstWeekRange = $firstWeekRange;
if ($firstWeekRange != null) {
$matches = [];
preg_match( '/([0-9]{2}\/[0-9]{2}\/[0-9]{4}) - ([0-9]{2}\/[0-9]{2}\/[0-9]{4})/', $firstWeekRange, $matches);
$this->firstWeekStart = new \DateTime($matches[1]);
$this->firstWeekEnd = new \DateTime($matches[2]);
}
return $this;
}
public function getFirstWeekRange() {
if ($this->firstWeekStart && $this->firstWeekEnd) {
return $this->firstWeekStart->format('m-d-Y').' - '.$this->firstWeekEnd->format('m-d-Y');
}
return $this->firstWeekRange;
}
public function setSecondWeekRange(string $secondWeekRange) {
$this->secondWeekRange = $secondWeekRange;
if ($this->secondWeekRange != null) {
$matches = [];
preg_match( '/([0-9]{2}\/[0-9]{2}\/[0-9]{4}) - ([0-9]{2}\/[0-9]{2}\/[0-9]{4})/', $secondWeekRange, $matches);
$this->secondWeekStart = new \DateTime($matches[1]);
$this->secondWeekEnd = new \DateTime($matches[2]);
}
return $this;
}
public function getSecondWeekRange() {
if ($this->secondWeekStart && $this->secondWeekEnd) {
return $this->secondWeekStart->format('m-d-Y').' - '.$this->secondWeekEnd->format('m-d-Y');
}
return $this->secondWeekRange;
}
public function getFirstFile(): ?array
{
return $this->firstFile;
}
public function setFirstFile(?array $firstFile): self
{
$this->firstFile = $firstFile;
return $this;
}
public function getSecondFile(): ?array
{
return $this->secondFile;
}
public function setSecondFile(array $secondFile): self
{
$this->secondFile = $secondFile;
return $this;
}
public function getDirectory(): ?array
{
return $this->directory;
}
public function setDirectory(?array $directory): self
{
$this->directory = $directory;
return $this;
}
}