mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-20 22:53:49 +00:00
fix relation inside calendar, bootstrap messenger for handling create and update calendar entity
This commit is contained in:
@@ -37,11 +37,13 @@ use Symfony\Component\Validator\Mapping\ClassMetadata;
|
||||
use function in_array;
|
||||
|
||||
/**
|
||||
* @ORM\Table(name="chill_calendar.calendar")
|
||||
* @ORM\Table(name="chill_calendar.calendar", indexes={@ORM\Index(name="idx_calendar_remote", columns={"remoteId"})}))
|
||||
* @ORM\Entity(repositoryClass=CalendarRepository::class)
|
||||
*/
|
||||
class Calendar implements TrackCreationInterface, TrackUpdateInterface
|
||||
{
|
||||
use RemoteCalendarTrait;
|
||||
|
||||
use TrackCreationTrait;
|
||||
|
||||
use TrackUpdateTrait;
|
||||
@@ -64,7 +66,7 @@ class Calendar implements TrackCreationInterface, TrackUpdateInterface
|
||||
private ?Activity $activity = null;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="CalendarRange", inversedBy="calendars")
|
||||
* @ORM\OneToOne(targetEntity="CalendarRange", inversedBy="calendar")
|
||||
* @Serializer\Groups({"calendar:read", "read"})
|
||||
*/
|
||||
private ?CalendarRange $calendarRange = null;
|
||||
@@ -405,6 +407,8 @@ class Calendar implements TrackCreationInterface, TrackUpdateInterface
|
||||
{
|
||||
$this->calendarRange = $calendarRange;
|
||||
|
||||
$this->calendarRange->setCalendar($this);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
@@ -17,8 +17,6 @@ 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;
|
||||
|
||||
@@ -35,10 +33,9 @@ class CalendarRange implements TrackCreationInterface, TrackUpdateInterface
|
||||
use TrackUpdateTrait;
|
||||
|
||||
/**
|
||||
* @ORM\OneToMany(targetEntity=Calendar::class,
|
||||
* mappedBy="calendarRange")
|
||||
* @ORM\OneToOne(targetEntity=Calendar::class, mappedBy="calendarRange")
|
||||
*/
|
||||
private Collection $calendars;
|
||||
private Calendar $calendar;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="datetimetz_immutable")
|
||||
@@ -66,13 +63,13 @@ class CalendarRange implements TrackCreationInterface, TrackUpdateInterface
|
||||
*/
|
||||
private ?User $user = null;
|
||||
|
||||
//TODO Lieu
|
||||
|
||||
public function __construct()
|
||||
public function getCalendar(): Calendar
|
||||
{
|
||||
$this->calendars = new ArrayCollection();
|
||||
return $this->calendar;
|
||||
}
|
||||
|
||||
//TODO Lieu
|
||||
|
||||
public function getEndDate(): ?DateTimeImmutable
|
||||
{
|
||||
return $this->endDate;
|
||||
@@ -93,6 +90,14 @@ class CalendarRange implements TrackCreationInterface, TrackUpdateInterface
|
||||
return $this->user;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal use {@link (Calendar::setCalendarRange)} instead
|
||||
*/
|
||||
public function setCalendar(Calendar $calendar): void
|
||||
{
|
||||
$this->calendar = $calendar;
|
||||
}
|
||||
|
||||
public function setEndDate(DateTimeImmutable $endDate): self
|
||||
{
|
||||
$this->endDate = $endDate;
|
||||
|
Reference in New Issue
Block a user