95 lines
1.7 KiB
PHP
95 lines
1.7 KiB
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace App\Entity;
|
||
|
|
|
||
|
|
use Doctrine\Common\Collections\ArrayCollection;
|
||
|
|
|
||
|
|
class VacationDay implements \JsonSerializable
|
||
|
|
{
|
||
|
|
/**
|
||
|
|
* @var int
|
||
|
|
*/
|
||
|
|
private $day;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @var string[]|ArrayCollection
|
||
|
|
*/
|
||
|
|
private $signums;
|
||
|
|
|
||
|
|
public function __construct()
|
||
|
|
{
|
||
|
|
$this->signums = new ArrayCollection();
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @return int
|
||
|
|
*/
|
||
|
|
public function getDay(): int
|
||
|
|
{
|
||
|
|
return $this->day;
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @param int $day
|
||
|
|
* @return VacationDay
|
||
|
|
*/
|
||
|
|
public function setDay(int $day): VacationDay
|
||
|
|
{
|
||
|
|
$this->day = $day;
|
||
|
|
return $this;
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @return ArrayCollection|string[]
|
||
|
|
*/
|
||
|
|
public function getSignums()
|
||
|
|
{
|
||
|
|
return $this->signums;
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @param ArrayCollection|string[] $signums
|
||
|
|
* @return VacationDay
|
||
|
|
*/
|
||
|
|
public function setSignums($signums): VacationDay
|
||
|
|
{
|
||
|
|
$this->signums = $signums;
|
||
|
|
return $this;
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @param string $signum
|
||
|
|
* @return VacationDay
|
||
|
|
*/
|
||
|
|
public function addSignum(string $signum): VacationDay
|
||
|
|
{
|
||
|
|
if(!$this->signums->contains($signum)) {
|
||
|
|
$this->signums->add($signum);
|
||
|
|
}
|
||
|
|
return $this;
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @param string $signum
|
||
|
|
* @return VacationDay
|
||
|
|
*/
|
||
|
|
public function removeSignum(string $signum): VacationDay
|
||
|
|
{
|
||
|
|
if($this->signums->contains($signum)) {
|
||
|
|
$this->signums->removeElement($signum);
|
||
|
|
}
|
||
|
|
return $this;
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @return array
|
||
|
|
*/
|
||
|
|
function jsonSerialize()
|
||
|
|
{
|
||
|
|
return [
|
||
|
|
'day' => $this->getDay(),
|
||
|
|
'signums' => $this->getSignums()->getValues(),
|
||
|
|
];
|
||
|
|
}
|
||
|
|
}
|