-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[FrameworkBundle] Fix for Controller DEPRECATED when using composer --optimized #30993
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
Conversation
If this is accepted I think we should rely on the DebugClassLoader (see https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Debug/DebugClassLoader.php#L283) instead of the constructor which isn't safe (it may be overriden). |
…imized Update Controller.php Update Controller.php
I think it's ok to remove |
Why is this triggered? What does trigger it? What is specific to |
I don't sure why it happens, but you can test it by yourself. If you will use And if you using |
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 inspected the reason why this is needed: FrameworkExtension calls addAnnotatedClassesToCompile with '**\\Controller\\'
, which means that when the class map is dumped, all the matching classes are parsed for annotations at cache warm-up. Controller
is one of them - and there is no way to exclude it. We could certainly find a way to exclude it, but that'd be a new feature.
The current patch is way more pragmatic for the use case.
👍
Thank you @aweelex. |
… composer --optimized (aweelex) This PR was merged into the 4.2 branch. Discussion ---------- [FrameworkBundle] Fix for Controller DEPRECATED when using composer --optimized | Q | A | | --- | --- | | Branch? | 4.2 | | Bug fix? | Yes | | New feature? | No | | BC breaks? | No | | Deprecations? | No | | Tests pass? | Yes | | Fixed tickets | --- | | License | MIT | Using `composer --optimize-autoload` causes `console cache:clear` (without warmup) to give DEPRECATED error, that stays in profiler. I moved `@trigger_error` from beggining of the file to Controller __consctruct method. Commits ------- 2ae2fd8 [FrameworkBundle] Fix Controller deprecated when using composer --optimized
Using
composer --optimize-autoload
causesconsole cache:clear
(without warmup) to give DEPRECATED error, that stays in profiler.I moved
@trigger_error
from beggining of the file to Controller __consctruct method.