Skip to content

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

Open

Description

@jacekpcmaniak

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"

Activity

  1. ibrasdev commented on Jan 11, 2018

    @ibrasdev

    did u solve that i have the same problem

  2. ancarebeca commented on Jan 14, 2018

    @ancarebeca
    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions