mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 07:03:49 +00:00
WIP: create and edit calendar
This commit is contained in:
@@ -12,6 +12,10 @@ declare(strict_types=1);
|
||||
namespace Chill\CalendarBundle\Entity;
|
||||
|
||||
use Chill\CalendarBundle\Repository\InviteRepository;
|
||||
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\User;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
@@ -19,31 +23,54 @@ use Doctrine\ORM\Mapping as ORM;
|
||||
* @ORM\Table(name="chill_calendar.invite")
|
||||
* @ORM\Entity(repositoryClass=InviteRepository::class)
|
||||
*/
|
||||
class Invite
|
||||
class Invite implements TrackUpdateInterface, TrackCreationInterface
|
||||
{
|
||||
use TrackCreationTrait;
|
||||
|
||||
use TrackUpdateTrait;
|
||||
|
||||
public const ACCEPTED = 'accepted';
|
||||
|
||||
public const DECLINED = 'declined';
|
||||
|
||||
public const PENDING = 'pending';
|
||||
|
||||
public const TENTATIVELY_ACCEPTED = 'tentative';
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity=Calendar::class, inversedBy="invites")
|
||||
*/
|
||||
private ?Calendar $calendar;
|
||||
|
||||
/**
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue
|
||||
* @ORM\Column(type="integer")
|
||||
*/
|
||||
private $id;
|
||||
private ?int $id;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="json")
|
||||
* @ORM\Column(type="text", nullable=false, options={"default": "pending"})
|
||||
*/
|
||||
private array $status = [];
|
||||
private string $status = self::PENDING;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\User")
|
||||
* @ORM\JoinColumn(nullable=false)
|
||||
*/
|
||||
private User $user;
|
||||
private ?User $user;
|
||||
|
||||
public function getCalendar(): ?Calendar
|
||||
{
|
||||
return $this->calendar;
|
||||
}
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getStatus(): ?array
|
||||
public function getStatus(): string
|
||||
{
|
||||
return $this->status;
|
||||
}
|
||||
@@ -53,7 +80,17 @@ class Invite
|
||||
return $this->user;
|
||||
}
|
||||
|
||||
public function setStatus(array $status): self
|
||||
/**
|
||||
* @internal use Calendar::addInvite instead
|
||||
* @param Calendar|null $calendar
|
||||
* @return void
|
||||
*/
|
||||
public function setCalendar(?Calendar $calendar): void
|
||||
{
|
||||
$this->calendar = $calendar;
|
||||
}
|
||||
|
||||
public function setStatus(string $status): self
|
||||
{
|
||||
$this->status = $status;
|
||||
|
||||
|
Reference in New Issue
Block a user