-
Notifications
You must be signed in to change notification settings - Fork 8
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
Override ControllerResolver as a shared service #5
Override ControllerResolver as a shared service #5
Conversation
Please let me know if you want a pull request for the changes needed to make this bridge compatible to Silex 2 / Pimple 3, too. |
87f3b82
to
0d6cb77
Compare
Thank for the pull request! I did this change this morning (replacing the closure with directly setting the instance) because I thought why not: the controller resolver will (almost) always be instantiated so we might as well avoid the closure overhead (very little optimization of course, but again why not). All tests are green with Silex/Pimple v1 so I guess it currently works with this version. The fact that it's a bug for Silex 2/Pimple 3 means we are definitely better off merging that! The work you did for compatibility with the new versions is great! Are you sure it's possible to make this package compatible with both versions at the same time? If it is, then I'd love to merge all your changes back. By the way do you know when Silex 2 will be released? I didn't even see a beta, are you using it on a project? |
I just took a closer look at how Pimple works in the inside. And even though the way how Pimple works has changed quite a bit from version 1 to 3, this specific behaviour has remained the same. The answer to "why not" is, that it's only possible to Therefore this should be a bug in version 1, too. But it only arises if you try to I'm registering Silex's |
Regarding the compatibility for both Silex/Pimple versions at the same time: I'm not sure if this will work because Pimple switched it's behaviour regarding shared/factory service definitions. I will take a closer look and play around a bit with both versions in the next days to see if it works, before sending a pull request. The problem is, that in Pimple 1 you create a factory service by simply setting a closure. If you want a shared service instead, you have to wrap it with When I think about it now, we may simply check for Sadyl I don't know when Silex 2 will be released. There is a Silex 2 roadmap issue which was closed a while ago, but no one seems to know when a final release will eventually happen. |
Thanks for the info. I'll be merging this now and releasing then. For Silex 2 support there's no rush since there is not really information about this :/ |
…vice Override ControllerResolver as a shared service
After I thought a little bit more about this, I don't think it would be wise to support Pimple 1 and 3 at the same time because of its twist regarding the behaviour of registering shared / factory services. I'm going to track Silex 2 development in my own fork and create a pull request when it's released, unless you want me to create it now. |
Sounds good to me! |
I just wanted to give this bridge a try with a Silex 2 project and stumbled upon a bug with the overridden
ControllerResolver
being not registered as a Pimpleservice
but as aparameter
.As this bridge doesn't support Silex 2/Pimple 3 by default (because there are some breaking changes in Pimple 3 and Silex 2) and I have no Silex 1/Pimple 1 project at hand I cannot surely confirm that this is a bug there too, but as Silex itself registeres its
ControllerResolver
(and every other class) as a (shared) service and not as a parameter I think we should do here, too.This was the exception I ran into: