-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[FrameworkBundle] Add a framework aware base command #23632
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
Not sure about this one. It's kind of equivalent to |
Agree. We should definitively choose one, not having both. First; i think it's ok for framework commands to rely on the framework application (getApplication()->getKernel()), it that's needed. After #23624 all framework commands rely on this. This PR creates a safeguard for that approach as currently we blindly assume this method exists. Note kernel-aware and container-aware are semantically 2 different approaches for a command, currently we do both in the framework and ContainerAwareCommand wires both. With kernel aware you rely on the kernel container, not just any injected container (as implied by container aware). Imo. it's good to be explicit, either be kernel aware (extend Command from this PR), or be container aware (implement ContainerAwareInterface or inject as a service yourself) but dont mix&match. |
Agree on the intent here, IDEs complain about it and we probably don't want to duplicate this instanceof check everywhere. Last remaining concern: is it worth it at all? I think we need more opinions |
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.
At least I agree about removing the getContainer
method.
return parent::getApplication(); | ||
} | ||
|
||
protected function getKernel() |
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.
Missing docblock for the return.
Removed getContainer()
I see a few options;
|
Not worth it if you ask me. |
Right. Lets leave it asis then 👍 |
Enables deprecating
ContainerAwareCommand
(#21623) by providing a base command that is kernel aware, thus container aware.Core could heavily use this as of 4.0, and basically fixes IDE's on
getApplication
.