Skip to content
This repository has been archived by the owner on Jan 21, 2020. It is now read-only.

Argument 1 passed to ZendDeveloperTools\Listener\EventLoggingListenerAggregate::onCollectEvent() must be an instance of Zend\EventManager\Event #200

Closed
wants to merge 3 commits into from

Conversation

alex-patterson-webdev
Copy link
Contributor

I have been using a custom event implementing interface Zend\EventManager\EventInterface without extending from the class Zend\EventManager\Event. When such and event is triggered within my application and ZendDeveloperTools is enabled, I receive the following exception message:

Catchable fatal error: Argument 1 passed to ZendDeveloperTools\Listener\EventLoggingListenerAggregate::onCollectEvent() must be an instance of Zend\EventManager\Event

The following classes currently type hint on Zend\EventManager\Event; I propose these are updated to use Zend\EventManager\EventInterface instead.

  • ZendDeveloperTools/Collector/EventCollectorInterface.php
  • ZendDeveloperTools/Collector/MemoryCollector.php
  • ZendDeveloperTools/Collector/TimeCollector.php
  • ZendDeveloperTools/Listener/EventLoggingListenerAggregate.php

@@ -23,5 +23,5 @@
* @param string $id
* @param Event $event
*/
public function collectEvent($id, Event $event);
public function collectEvent($id, EventInterface $event);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change can't be implemented until version 2.0.0 of the module, as it is a major BC break

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And yes, it is a major mistake in designing this interface in first place :-(

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah no problem; I thought as much :-)

@weierophinney weierophinney added this to the 2.0.0 milestone Sep 8, 2016
@samsonasik
Copy link
Contributor

need rebase

@mimmi20
Copy link

mimmi20 commented Apr 18, 2018

I tried to use the EventFeature of Zend\Db and got the same Error.

weierophinney added a commit that referenced this pull request Dec 26, 2019
@weierophinney
Copy link
Member

Merged to develop for release with 2.0.0.

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

Successfully merging this pull request may close these issues.

None yet

5 participants