display events in fullcalendarBundle symfony3.4 [closed]

I installed fullcalendarbundle, and I configured it as it is mentioned on the Github https://github.com/tattali/CalendarBundle/blob/master/src/Resources/doc/doctrine-crud.md#3-create-the-crud, I can display the calendar and create events. But, I can display the events in the calendar. I have the impression that it does not detect my CalendarSubscriber file, reason why even if I make errors they do not report anything

here is my CalendarSubcriber.php

namespace AppEventSubscriber;
use AppBundleRepositoryCalendarEventsRepository;
use CalendarBundleCalendarEvents;
use CalendarBundleEntityEvent;
use CalendarBundleEventCalendarEvent;
use SymfonyComponentEventDispatcherEventSubscriberInterface;
use SymfonyComponentRoutingGeneratorUrlGeneratorInterface;

class CalendarSubscriber implements EventSubscriberInterface
private $calendarEventsRepository;
private $router;

public function __construct(
    CalendarEventsRepository $calendarEventsRepository,
    UrlGeneratorInterface $router
) {
    $this->calendarEventsRepository = $calendarEventsRepository;
    $this->router = $router;

public static function getSubscribedEvents()
    return [
        CalendarEvents::SET_DATA => 'onCalendarSetData',

public function onCalendarSetData(CalendarEvent $calendar)
    $start = $calendar->getStart();
    $end = $calendar->getEnd();
    $filters = $calendar->getFilters();

    // Modify the query to fit to your entity and needs
    // Change booking.beginAt by your start date property
    $calendars = $this->calendarEventsRepository
        ->where('calendar.datedebut BETWEEN :debut and :fin OR calendar.datefin BETWEEN :debut and :fin')
        ->setParameter('debut', $start->format('Y-m-d H:i:s'))
        ->setParameter('fin', $end->format('Y-m-d H:i:s'))

    foreach ($calendars as $c) {
        // this create the events with your data (here booking data) to fill calendar
        $calendarsEvent = new Event(
            $c->getDatefin() // If the end date is null or not defined, a all day event is created.

         * Add custom options to events
         * For more information see: https://fullcalendar.io/docs/event-object
         * and: https://github.com/fullcalendar/fullcalendar/blob/master/src/core/options.ts

            'backgroundColor' => 'red',
            'borderColor' => 'red',
            $this->router->generate('booking_show', [
                'id' => $c->getId(),

        // finally, add the event to the CalendarEvent to fill the calendar

here is my calendar.yaml path in my projet

his content

    resource: "@CalendarBundle/Resources/config/routing.yaml"

Thanks for help !

Source: Symfony Questions

Was this helpful?

0 / 0

Leave a Reply 0

Your email address will not be published. Required fields are marked *