Skip to content

Update dispatch call #467

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

Closed
wants to merge 1 commit into from
Closed

Conversation

XWB
Copy link
Member

@XWB XWB commented Nov 6, 2019

I may have forgotten something in #463

// LegacyEventDispatcherProxy exists in Symfony >= 4.3
if (class_exists(LegacyEventDispatcherProxy::class)) {
// New Symfony 4.3 EventDispatcher signature
$this->getEventDispatcher()->dispatch($event, $name);
Copy link
Contributor

Choose a reason for hiding this comment

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

isn't the point of the legacy proxy that we then can use the same code regardless of dispatcher version?

Copy link
Member Author

Choose a reason for hiding this comment

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

Apparently not. The LegacyEventDispatcherProxy triggers a deprecation notice if you use the old syntax: https://github.com/symfony/event-dispatcher/blob/4.3/LegacyEventDispatcherProxy.php#L63

And LegacyEventDispatcherProxy is not available in Symfony versions below 4.3 so there is no other way around this hack.

Copy link
Contributor

Choose a reason for hiding this comment

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

but if we do all that, why do we use the legacy dispatcher at all? does it do anything for us, or could we just conditionally use the new order if we are on a new enough version?

Copy link
Contributor

Choose a reason for hiding this comment

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

@XWB ping ;-)

Copy link
Member Author

Choose a reason for hiding this comment

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

@dbu Because if somebody extends EventDispatchingHttpCache, the LegacyEventDispatcherProxy will make sure the old dispatcher syntax will continue to work.

@dbu
Copy link
Contributor

dbu commented Nov 25, 2019

thanks @XWB ! @andrerom wrapped this up in #468

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

Successfully merging this pull request may close these issues.

2 participants