8000 [FrameworkBundle][Routing] deprecation error when decorating routing.loader · Issue #24886 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[FrameworkBundle][Routing] deprecation error when decorating routing.loader #24886

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
kbond opened this issue Nov 9, 2017 · 6 comments
Closed

Comments

@kbond
Copy link
Member
kbond commented Nov 9, 2017
Q A
Bug report? yes
Feature request? no
BC Break report? no
RFC? no
Symfony version 3.4-BETA

When decorating routing.loader in a compiler pass I get the following deprecation error when the container is built:

User Deprecated: The "routing.loader" service is private, getting it from the container is deprecated since Symfony 3.2 and will fail in 4.0. You should either make the service public, or stop using the container directly and use dependency injection instead.

I can't figure out why this is happening.

Reference: umpirsky/UmpirskyI18nRoutingBundle#17
CompilerPass: https://github.com/umpirsky/UmpirskyI18nRoutingBundle/blob/a69bd4dcc901c3459aba20f8e586613a5758d05b/src/DependencyInjection/Compiler/OverrideRoutingCompilerPass.php

profiler

@sroze
Copy link
Contributor
sroze commented Nov 10, 2017

@kbond which beta is that?

@sroze
Copy link
Contributor
sroze commented Nov 10, 2017

Well, actually it's clearly the UmpirskyI18nRoutingBundle relying on a private service... I'm not sure why it is doing that but it's very likely it can be re-written on their side to only use the router and tagging their resources as route loader I guess.

@ogizanagi
Copy link
Contributor

The router.loader service still is public (see #24738), but the pass decorates it and create an alias:

https://github.com/umpirsky/UmpirskyI18nRoutingBundle/blob/a69bd4dcc901c3459aba20f8e586613a5758d05b/src/DependencyInjection/Compiler/OverrideRoutingCompilerPass.php#L27

This alias should be explicitly marked as public since #24104, otherwise it'll be considered private.

@xabbuh
Copy link
Member
xabbuh commented Nov 10, 2017

closing here as this is indeed not a bug as @ogizanagi explained

@xabbuh xabbuh closed this as completed Nov 10, 2017
@stof
Copy link
Member
stof commented Nov 10, 2017

Well, the simpler solution for the UmpirskyI18nRoutingBundle would be to use the service decoration feature of Symfony, which is available since Symfony 2.5, instead of duplicating it.
This way, it would not have to deal with the changes required in the implementation of decoration for newer versions of Symfony (and would not make assumptions about the visibility of core services)

@kbond
Copy link
Member Author
kbond commented Nov 10, 2017

Thanks everyone, service decoration solved my issue.

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

No branches or pull requests

5 participants
0