adding location to ranges and more control on MyCalendarRanges

This commit is contained in:
2022-06-29 15:28:37 +02:00
parent 809a0a38ab
commit 849e7158e4
13 changed files with 357 additions and 78 deletions

View File

@@ -15,10 +15,12 @@ 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\Location;
use Chill\MainBundle\Entity\User;
use DateTimeImmutable;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation\Groups;
use Symfony\Component\Validator\Constraints as Assert;
/**
* @ORM\Table(
@@ -42,7 +44,8 @@ class CalendarRange implements TrackCreationInterface, TrackUpdateInterface
/**
* @ORM\Column(type="datetime_immutable", nullable=false)
* @groups({"read", "write", "calendar:read"})
* @Groups({"read", "write", "calendar:read"})
* @Assert\NotNull()
*/
private ?DateTimeImmutable $endDate = null;
@@ -50,29 +53,54 @@ class CalendarRange implements TrackCreationInterface, TrackUpdateInterface
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
* @groups({"read"})
* @Groups({"read"})
*/
private $id;
/**
* @ORM\ManyToOne(targetEntity=Location::class)
* @ORM\JoinColumn(nullable=false)
* @Groups({"read", "write", "calendar:read"})
* @Assert\NotNull()
*/
private ?Location $location;
/**
* @ORM\Column(type="datetime_immutable", nullable=false)
* @groups({"read", "write", "calendar:read"})
* @Assert\NotNull()
*/
private ?DateTimeImmutable $startDate = null;
/**
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\User")
* @groups({"read", "write", "calendar:read"})
* @Groups({"read", "write", "calendar:read"})
* @Assert\NotNull()
*/
private ?User $user = null;
/**
* @return Location|null
*/
public function getLocation(): ?Location
{
return $this->location;
}
/**
* @param Location|null $location
*/
public function setLocation(?Location $location): void
{
$this->location = $location;
}
public function getCalendar(): ?Calendar
{
return $this->calendar;
}
//TODO Lieu
public function getEndDate(): ?DateTimeImmutable
{
return $this->endDate;