Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[FrameworkBundle][Routing] Add a new tag to be able to use a private service as a service route loader#30926
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
e05abac tod3a2998Compared3a2998 to93584ebCompare
nicolas-grekas left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
changelog+upgrade files need an update also
src/Symfony/Component/Routing/Loader/DependencyInjection/ServiceRouterLoaderContainer.phpShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
src/Symfony/Component/Routing/Loader/DependencyInjection/ServiceRouterLoaderContainer.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
fancyweb commentedApr 7, 2019 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
@nicolas-grekas I added the UPGRADE entries already. For the CHANGELOG of the Routing component there is nothing to say IMO. We added a marker interface, an instantly deprecated / internal class, and a compiler pass used by the Framework Bundle 😕 |
src/Symfony/Bundle/FrameworkBundle/Tests/Kernel/MicroKernelTraitTest.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
src/Symfony/Component/Routing/Loader/DependencyInjection/ServiceRouterLoaderContainer.phpShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
src/Symfony/Component/Routing/Loader/DependencyInjection/ServiceRouterLoaderInterface.phpShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
src/Symfony/Component/Routing/DependencyInjection/ServiceRouterLoaderPass.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
...fony/Component/Routing/Tests/Loader/DependencyInjection/ServiceRouterLoaderContainerTest.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
javiereguiluz commentedApr 24, 2019
Ping@fancyweb. Will you have some time to make the last requested changes? It'd be nice to have this for Symfony 4.3. Thanks! |
fancyweb commentedApr 24, 2019
I will definitely finish this work before the end of the month. |
3a30564 to9c5e31aCompare| <serviceid="routing.loader.service"class="Symfony\Component\Routing\Loader\DependencyInjection\ServiceRouterLoader"> | ||
| <tagname="routing.loader" /> | ||
| <argumenttype="service"id="service_container" /> | ||
| <argumenttype="service"id="routing.loader.service.container" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
In 5.0, replace this argument with the above tagged locator.
src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
chalasr commentedMay 5, 2019
Although I find |
9c5e31a to0bb19b7CompareUPGRADE-4.3.md Outdated
| options have been deprecated. | ||
| * Implementing `Serializable` for `Route` and `CompiledRoute` is deprecated; if you serialize them, please | ||
| ensure your unserialization logic can recover from a failure related to an updated serialization format | ||
| * Not tagging the route loader services with `routing.router_loader` has been deprecated. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
route loader vsrouter_loader
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I think router loader is way better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
In this case, if the "public" name is now router loader, I guess we should update the whole documentation page (https://symfony.com/doc/current/routing/custom_route_loader.html)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
and I meantroute loader, sorry
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Do you mean you want to move back to the original tag namerouting.route_loader?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Works for me, let's rename the interface + existing implementation, I suggest deprecatingServiceRouterLoader in favor ofContainerRouteLoader.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
WDYT of renaming everything in another PR after this one is merged for clarity ? First, finish this one (I just need to rename the tag back torouting.route_loader). Then, another one of pure refacto.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
…service as a service route loader
0bb19b7 to205497bComparesrc/Symfony/Component/Routing/Loader/DependencyInjection/ServiceRouterLoaderContainer.phpShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.phpShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
src/Symfony/Component/Routing/Loader/DependencyInjection/ServiceRouterLoaderInterface.phpShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
| * | ||
| * @deprecated since Symfony 4.3, to be removed in 5.0 | ||
| */ | ||
| class ServiceRouterLoaderContainerimplements ContainerInterface |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
RouterLoaderContainer?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I suggestedContainerRouteLoader, consistent with e.g.https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Console/CommandLoader/ContainerCommandLoader.php
…gged locators (nicolas-grekas)This PR was merged into the 4.3 branch.Discussion----------[DI] default to service id - *not* FQCN - when building tagged locators| Q | A| ------------- | ---| Branch? | 4.3| Bug fix? | yes| New feature? | no| BC breaks? | no| Deprecations? | no| Tests pass? | no| Fixed tickets | -| License | MIT| Doc PR | -While reviewing#30926 I realized that defaulting to the FQCN is a shortcut that isn't useful enough.Defaulting to the service id provides the same experience in practice because service ids are FQCN by default.But when they aren't, the service id is the proper index to default to when building the locator.Commits-------52e827c [DI] default to service id - *not* FQCN - when building tagged locators
nicolas-grekas commentedMay 13, 2019
#31463 is now merged, this can be rebased to leverage it and take comments into account. Thanks :) |
fancyweb commentedJul 17, 2019
I'm closing here becaus it's a mess and I will reopen new splitted PRs 👀 |
…eLoader in favor of ContainerLoader and ObjectLoader (fancyweb)This PR was merged into the 4.4 branch.Discussion----------[Routing] Deprecate ServiceRouterLoader and ObjectRouteLoader in favor of ContainerLoader and ObjectLoader| Q | A| ------------- | ---| Branch? | 4.4| Bug fix? | no| New feature? | no| BC breaks? | no| Deprecations? | yes| Tests pass? | yes| Fixed tickets |#30926 (comment)| License | MIT| Doc PR | -This PR aims at deprecating some things to have a more consistent code.### ServiceRouterLoader1. This class actually fetches an object from a container. In#30926 (comment), it was suggested that it should be renamed to `ContainerRouteLoader`. Actually I think it's better to rename it to `ContainerLoader` since all others route loaders does not have "Route" in their name. Let's be consistent!2. This class is in a `DependencyInjection` sub directory for historical reasons. Let's remove that! It accepts any PSR-11 container.### ObjectRouteLoader1. This class has "Route" in its name too. Let's rename it!2. This class is supposed to be an abstract implementation for "object" loaders to reuse, but in its code it has a lot of references to "services". Let's remove those references! That means renaming some methods, altering messages, etc.. That also means removing the `supports` method from it to let extending classes implement it.3. IMHO, this abstract implementation is useless. We sould just deprecate the whole class and move the implemention in the `ContainerLoader` class.Commits-------1548101 [Routing] Deprecate ServiceRouterLoader and ObjectRouteLoader in favor of ContainerLoader and ObjectLoader
…eLoader in favor of ContainerLoader and ObjectLoader (fancyweb)This PR was merged into the 4.4 branch.Discussion----------[Routing] Deprecate ServiceRouterLoader and ObjectRouteLoader in favor of ContainerLoader and ObjectLoader| Q | A| ------------- | ---| Branch? | 4.4| Bug fix? | no| New feature? | no| BC breaks? | no| Deprecations? | yes| Tests pass? | yes| Fixed tickets |symfony/symfony#30926 (comment)| License | MIT| Doc PR | -This PR aims at deprecating some things to have a more consistent code.### ServiceRouterLoader1. This class actually fetches an object from a container. Insymfony/symfony#30926 (comment), it was suggested that it should be renamed to `ContainerRouteLoader`. Actually I think it's better to rename it to `ContainerLoader` since all others route loaders does not have "Route" in their name. Let's be consistent!2. This class is in a `DependencyInjection` sub directory for historical reasons. Let's remove that! It accepts any PSR-11 container.### ObjectRouteLoader1. This class has "Route" in its name too. Let's rename it!2. This class is supposed to be an abstract implementation for "object" loaders to reuse, but in its code it has a lot of references to "services". Let's remove those references! That means renaming some methods, altering messages, etc.. That also means removing the `supports` method from it to let extending classes implement it.3. IMHO, this abstract implementation is useless. We sould just deprecate the whole class and move the implemention in the `ContainerLoader` class.Commits-------154810119d [Routing] Deprecate ServiceRouterLoader and ObjectRouteLoader in favor of ContainerLoader and ObjectLoader
…rs (fancyweb)This PR was merged into the 4.4 branch.Discussion----------[FrameworkBundle][Routing] Private service route loaders| Q | A| ------------- | ---| Branch? | 4.4| Bug fix? | no| New feature? | yes| BC breaks? | no| Deprecations? | no| Tests pass? | yes| Fixed tickets |#30402| License | MIT| Doc PR |symfony/symfony-docs#11337Continuation of#30926.~Please review only the 2nd commit, I'm building this on top of#32582Commits-------64aa2c8 [FrameworkBundle][Routing] Private service route loaders
…rs (fancyweb)This PR was merged into the 4.4 branch.Discussion----------[FrameworkBundle][Routing] Private service route loaders| Q | A| ------------- | ---| Branch? | 4.4| Bug fix? | no| New feature? | yes| BC breaks? | no| Deprecations? | no| Tests pass? | yes| Fixed tickets |symfony/symfony#30402| License | MIT| Doc PR |symfony/symfony-docs#11337Continuation ofsymfony/symfony#30926.~Please review only the 2nd commit, I'm building this on top ofsymfony/symfony#32582Commits-------64aa2c8529 [FrameworkBundle][Routing] Private service route loaders
Uh oh!
There was an error while loading.Please reload this page.
#eufossa
This PR adds a new tag
routing.route_loaderautoconfigured thanks to a newServiceRouterLoaderinterface to be able to use private route loader services.The deprecation layer is done through a temporary container that will be removed in 5.0.
TODO :