rdv: available calendar ranges

This commit is contained in:
nobohan
2021-08-19 15:19:25 +02:00
parent 0457ee2b8d
commit 65bce1aacb
6 changed files with 59 additions and 7 deletions

View File

@@ -116,7 +116,7 @@ class Calendar
private ?CancelReason $cancelReason = null;
/**
* @ORM\ManyToOne(targetEntity="CalendarRange")
* @ORM\ManyToOne(targetEntity="CalendarRange", inversedBy="calendars")
*/
private ?CalendarRange $calendarRange = null;

View File

@@ -4,6 +4,8 @@ namespace Chill\CalendarBundle\Entity;
use Chill\CalendarBundle\Repository\CalendarRangeRepository;
use Chill\MainBundle\Entity\User;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation\Groups;
@@ -23,7 +25,7 @@ class CalendarRange
/**
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\User")
* @groups({"read"})
* @Groups({"read"})
*/
private User $user;
@@ -39,8 +41,19 @@ class CalendarRange
*/
private \DateTimeImmutable $endDate;
/**
* @ORM\OneToMany(targetEntity=Calendar::class,
* mappedBy="calendarRange")
*/
private Collection $calendars;
//TODO Lieu
public function __construct()
{
$this->calendars = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;