Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Listener::loadData() must be an instance #36

Open
jacekpcmaniak opened this issue Dec 24, 2017 · 2 comments
Open

Listener::loadData() must be an instance #36

jacekpcmaniak opened this issue Dec 24, 2017 · 2 comments
Labels

Comments

@jacekpcmaniak
Copy link

I did everything as in instruction, but i get:
"Catchable Fatal Error: Argument 1 passed to Ent\AppBundle\Listener\LoadDataListener::loadData() must be an instance of Ent\AppBundle\Listener\CalendarEvent, instance of AncaRebeca\FullCalendarBundle\Event\CalendarEvent given"

@ibrasdev
Copy link

did u solve that i have the same problem

@ancarebeca
Copy link
Owner

Sorry for the delay @jacekpcmaniak .
It looks like your listener class has loadData function has the wrong data type parameter ($calendarEvent). You have to set AncaRebeca\FullCalendarBundle\Event\CalendarEvent If you want to use type hinting, not Ent\AppBundle\Listener\CalendarEvent.

Have a look at

$event = $this->dispatcher->dispatch(
CalendarEvent::SET_DATA,
new CalendarEvent($startDate, $endDate, $filters)
);
the loadData function needs to receive the same class that Calendar.php is dispatching

You also have an example here https://github.com/ancarebeca/full-calendar-example/blob/master/src/AppBundle/EventListener/LoadDataListener.php

cc: @ibrasdev

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants