-
Notifications
You must be signed in to change notification settings - Fork 61
Silex 2.0 and 'Identifier "dispatcher" does not contain an object definition.' #70
Comments
I've had a similar issue and noticed that the sequence you add things to the container matters. For example, once I did |
Hmm, thanks for the suggestion @xiaohutai. The only reason I registered it last is because the documentation states, in italics, I might add:
I'll give switching things around a go anyway and see how that goes. |
I've also had this issue although not specifically with the web profiler but other service providers. I've also found that moving things around can sometimes help. It just sounds like something that is fundamentally broken with Silex and needs to be fixed. |
Same here, it seams to happen if $app['dispatcher'] was already evaluated with a |
Confirm that moving any dispatcher related code like addListener to the end fixes the problem |
To avoid this bug, I either add listener (or subscribers) in $this->before(function () {
$this['dispatcher']->addListener($eventName, $callback);
}); |
Registering the
WebProfilerServiceProvider
with the following code:Throws the following exception:
It seems that
Container::extend()
is throwing the exception because the value "dispatcher" (theEventDispatcher
object) doesn't contain the__invoke()
method:The text was updated successfully, but these errors were encountered: