mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
117 lines
2.6 KiB
PHP
117 lines
2.6 KiB
PHP
<?php
|
|
|
|
/**
|
|
* Chill is a software for social workers
|
|
*
|
|
* For the full copyright and license information, please view
|
|
* the LICENSE file that was distributed with this source code.
|
|
*/
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Chill\CalendarBundle\Entity;
|
|
|
|
use Chill\MainBundle\Doctrine\Model\TrackCreationInterface;
|
|
use Chill\MainBundle\Doctrine\Model\TrackCreationTrait;
|
|
use Chill\MainBundle\Doctrine\Model\TrackUpdateInterface;
|
|
use Chill\MainBundle\Doctrine\Model\TrackUpdateTrait;
|
|
use Chill\MainBundle\Entity\User;
|
|
use DateTimeImmutable;
|
|
use Doctrine\Common\Collections\ArrayCollection;
|
|
use Doctrine\Common\Collections\Collection;
|
|
use Doctrine\ORM\Mapping as ORM;
|
|
use Symfony\Component\Serializer\Annotation\Groups;
|
|
|
|
/**
|
|
* @ORM\Table(name="chill_calendar.calendar_range", indexes={@ORM\Index(name="idx_calendar_range_remote", columns={"remoteId"})})
|
|
* @ORM\Entity
|
|
*/
|
|
class CalendarRange implements TrackCreationInterface, TrackUpdateInterface
|
|
{
|
|
use RemoteCalendarTrait;
|
|
|
|
use TrackCreationTrait;
|
|
|
|
use TrackUpdateTrait;
|
|
|
|
/**
|
|
* @ORM\OneToMany(targetEntity=Calendar::class,
|
|
* mappedBy="calendarRange")
|
|
*/
|
|
private Collection $calendars;
|
|
|
|
/**
|
|
* @ORM\Column(type="datetimetz_immutable")
|
|
* @groups({"read", "write", "calendar:read"})
|
|
*/
|
|
private ?DateTimeImmutable $endDate = null;
|
|
|
|
/**
|
|
* @ORM\Id
|
|
* @ORM\GeneratedValue
|
|
* @ORM\Column(type="integer")
|
|
* @groups({"read"})
|
|
*/
|
|
private $id;
|
|
|
|
/**
|
|
* @ORM\Column(type="datetimetz_immutable")
|
|
* @groups({"read", "write", "calendar:read"})
|
|
*/
|
|
private ?DateTimeImmutable $startDate = null;
|
|
|
|
/**
|
|
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\User")
|
|
* @groups({"read", "write", "calendar:read"})
|
|
*/
|
|
private ?User $user = null;
|
|
|
|
//TODO Lieu
|
|
|
|
public function __construct()
|
|
{
|
|
$this->calendars = new ArrayCollection();
|
|
}
|
|
|
|
public function getEndDate(): ?DateTimeImmutable
|
|
{
|
|
return $this->endDate;
|
|
}
|
|
|
|
public function getId(): ?int
|
|
{
|
|
return $this->id;
|
|
}
|
|
|
|
public function getStartDate(): ?DateTimeImmutable
|
|
{
|
|
return $this->startDate;
|
|
}
|
|
|
|
public function getUser(): ?User
|
|
{
|
|
return $this->user;
|
|
}
|
|
|
|
public function setEndDate(DateTimeImmutable $endDate): self
|
|
{
|
|
$this->endDate = $endDate;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function setStartDate(DateTimeImmutable $startDate): self
|
|
{
|
|
$this->startDate = $startDate;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function setUser(?User $user): self
|
|
{
|
|
$this->user = $user;
|
|
|
|
return $this;
|
|
}
|
|
}
|