swarrot / SwarrotBundle

A symfony bundle for swarrot integration
MIT License
89 stars 59 forks source link

Fix Symfony 4.3 deprecations #160

Closed pvgnd closed 5 years ago

pvgnd commented 5 years ago

Related to #159

odolbeau commented 5 years ago

Hi @pvgnd & thanks for your PR. Unfortunately, bumping the minimal version of symfony to >= 4.3 will prevent a lot of users using the current LTS (3.4) to update this bundle. As mentioned in #159, I think the correct way to correct this deprecation is to encapsulate the current event around a big if / else in order to extend Symfony\Contracts\EventDispatcher\Event when available instead of Symfony\Component\EventDispatcher\Event. It also means, we'll have to change the way we dispatch events to check which EventDispatcher is available.

@stof Do you see any other way to achieve this?

pvgnd commented 5 years ago

I found that Symfony provide a Proxy class : https://symfony.com/blog/new-in-symfony-4-3-simpler-event-dispatching#supporting-both-dispatchers

odolbeau commented 5 years ago

Thanks, this correction looks great! I need to take some time to correct tests before merging this PR.

odolbeau commented 5 years ago

Tests have been fixed by #161 Could you please rebase your branch?

pvgnd commented 5 years ago

@odolbeau Is it ok for you ?

odolbeau commented 5 years ago

Looks great, thanks guys! :)