-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Unexpected deprecation message related to an entity #24569
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
Comments
Hmm would be nice if the deprecation would tell us which code is triggering this edge-case. Side note, the deprecation could be optimized by passing |
@javiereguiluz I think this is related to the autowiring of controller arguments (where you might have a typehint for a Post relying on param converters). As there is no autowirable service for this typehint, the AutowirePass triggers the BC layer to try finding one such service by type. |
@stof you are right! We use public function showAction(Post $post): Response Could this be considered a bug? We want to use |
Pretty much anything could be added as arguments there via the new controller arguments event and argument value resolvers. Besides of this, pretty much anything that's being set in the request object can be injected this way, not sure if you can catch all those cases. |
This process is carried out in |
@yceruto no, you can't know this as a lot of things are resolved during run-time execution. You can only know if they are available as service or not. Edit: This is why I don't like services as action arguments. |
So if we have explicit configuration that excludes resources: App\:
resource: '../src/*'
exclude: '../src/{Entity,Repository,Tests}' # <------ we can't use this information into <service id="autowired.App\Entity\Post" class="App\Entity\Post" public="false" autowire="true"/> this service is defined at compilation-time, so I hope there is some solution for that. |
So this is one of the big reasons that we removed the auto-registration of services for autowiring in 4.0. So in 4.0, it’s not an issue - the entities are excluded in services.yml, and then are not auto-registered during autowiring. But yes, the deprecation warning is a problem - a bug that we need to fix somehow. |
This is basically fixed with #24671 when enabled, isn't it? |
#24671 solves this problem for me. |
We're updating the Symfony Demo application to Symfony 3.4 (see symfony/demo#673). Most of the triggered deprecations make sense, but we're struggling with this one:
Why does that deprecation occur? We even exclude the entire
Entity/
directory from autowiring:The text was updated successfully, but these errors were encountered: