dunglas / DunglasActionBundle

Symfony controllers, redesigned
https://dunglas.fr/2016/01/dunglasactionbundle-symfony-controllers-redesigned/
MIT License
256 stars 14 forks source link

Make @Route work... without needing a custom route loader #37

Closed weaverryan closed 8 years ago

weaverryan commented 8 years ago

In #29, if I understand things correctly, we basically override the annotation route loader type from SFWExtraBundle. And I think that means that I now can't use the annotation type to load a mixture of traditional and service-based controllers. This is a little wtf-y to me :). In fact, I think that maybe I can't even have this bundle installed and expect to be able to load non-service controllers with @Route. If I'm wrong, please tell me! :)

Could we make the SFWExtraBundle's @Route functionality work with service controllers? Something to hint over to https://github.com/sensiolabs/SensioFrameworkExtraBundle/blob/master/Routing/AnnotatedRouteControllerLoader.php that we have a service and know its id? Obviously, work would need to be done in SFWExtraBundle - can we think of a good solution?

dunglas commented 8 years ago

We extend the one from Symfony core, not from SFWExtraBundle. You can mix them (there is even a test for that). Thanks to https://github.com/dunglas/DunglasActionBundle/blob/master/Routing/AnnotationDirectoryLoader.php#L41-L45, the loader from this bundle only take precedence for configured directories. And every controllers in such directories are registered as services.

dunglas commented 8 years ago

This bug is fixed. The last missing thing are Symfony 2.8 and 3.0 releases with this patch included.

dunglas commented 8 years ago

Done in #43