work on create calendar

This commit is contained in:
2022-05-13 13:49:24 +02:00
parent 7859439f0b
commit 4be3efc619
10 changed files with 128 additions and 44 deletions

View File

@@ -40,14 +40,14 @@ class Invite implements TrackUpdateInterface, TrackCreationInterface
/**
* @ORM\ManyToOne(targetEntity=Calendar::class, inversedBy="invites")
*/
private ?Calendar $calendar;
private ?Calendar $calendar = null;
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private ?int $id;
private ?int $id = null;
/**
* @ORM\Column(type="text", nullable=false, options={"default": "pending"})
@@ -58,7 +58,7 @@ class Invite implements TrackUpdateInterface, TrackCreationInterface
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\User")
* @ORM\JoinColumn(nullable=false)
*/
private ?User $user;
private ?User $user = null;
public function getCalendar(): ?Calendar
{
@@ -82,8 +82,6 @@ class Invite implements TrackUpdateInterface, TrackCreationInterface
/**
* @internal use Calendar::addInvite instead
* @param Calendar|null $calendar
* @return void
*/
public function setCalendar(?Calendar $calendar): void
{
@@ -99,6 +97,10 @@ class Invite implements TrackUpdateInterface, TrackCreationInterface
public function setUser(?User $user): self
{
if ($user instanceof User && $this->user instanceof User && $user !== $this->user) {
throw new \LogicException("Not allowed to associate an invite to a different user");
}
$this->user = $user;
return $this;