mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 07:03:49 +00:00
work on create calendar
This commit is contained in:
@@ -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;
|
||||
|
Reference in New Issue
Block a user