tattali / CalendarBundle

Provides event calendar for your Symfony project. Compatible with API like Google Calendar.

Home Page:https://packagist.org/packages/tattali/calendar-bundle

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Entity Event add resourceId

Nelly34 opened this issue · comments

Hi,
I use your bundle with fullcalendar 5.9 and it works perfectly. But I would like use it with fullcalendar-scheduler and I need an additional filed in Event entity like this:

/**
 * @var string
 */
protected $resourceId;

/**
* @var array
*/
protected $options = [];

public function __construct(
    string $title,
    DateTimeInterface $start,
    ?DateTimeInterface $end = null,
    ?string $resourceId = null,
    array $options = []
) {
    $this->setTitle($title);
    $this->setStart($start);
    $this->setEnd($end);
    $this->setResourceId($resourceId);
    $this->setOptions($options);
}

public function getResourceId(): ?string
{
    return $this->resourceId;
}

public function setResourceId(?string $resourceId): void
{
    $this->resourceId = $resourceId;
}

public function toArray(): array
{
    $event = [
        'title' => $this->getTitle(),
        'start' => $this->getStart()->format(self::DATE_FORMAT),
        'allDay' => $this->isAllDay(),
    ];

    if (null !== $this->getEnd()) {
        $event['end'] = $this->getEnd()->format(self::DATE_FORMAT);
    }

    if (null !== $this->getResourceId()) {
        $event['resourceId'] = $this->getResourceId();
    }
    return array_merge($event, $this->getOptions());
}

Is it possible to modify your bundle in this way ?
Thanks

Hi feel free to wrote a pull request :)

Thanks for the merge. Is it possible to tag the master branch.
Composer search the last tag and I don't receive the modification in master branch.

thanks