Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
Handle 'hidden' param from AsCommand attribute#41547
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
Handle 'hidden' param from AsCommand attribute#41547
Uh oh!
There was an error while loading.Please reload this page.
Conversation
OskarStark 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.
Looks good to me except my comment
Uh oh!
There was an error while loading.Please reload this page.
nicolas-grekas commentedJun 5, 2021
This patch doesn't fix the root issue. If you inspect the dumped container for example, you'll see that the command is correctly registered as hidden. |
| $isHidden =$attribute[0]->newInstance()->hidden; | ||
| } | ||
| return$this->hidden ||$isHidden; |
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.
For reviewers (and for the author): this patch cannot be correct, because it makes the attribute a mandatory piece of configuration that cannot be ignored. This is against the root principles of attributes, which should be purely declarative.
nicolas-grekas commentedJun 5, 2021 • 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.
Note that past some issue with registering commands, there is another one: when the |
yoannrenard commentedJun 5, 2021
As said@nicolas-grekas without DI, the command name is not parsed when the |
yoannrenard commentedJun 6, 2021
After more tests this morning, I've discovered that AsCommand attribute works fine with CI. I just didn't know that this attribute needed to clear the cache to work. My bad. I'll close this PR as it is wrong and push my fix for the usage without CI in another one. |
stof commentedJun 7, 2021
@yoannrenard the need to clear cache when changing attributes is caused by#39988 |
yoannrenard commentedJun 7, 2021
Thanks for the information@stof |
This PR was merged into the 5.3 branch.Discussion----------[Console] Fix using #[AsCommand] without DI| Q | A| ------------- | ---| Branch? | 5.3| Bug fix? | yes| New feature? | no| Deprecations? | no| Tickets |Fix#41547| License | MIT| Doc PR | -Commits-------c4357ea [Console] Fix using #[AsCommand] without DI
Uh oh!
There was an error while loading.Please reload this page.
The recently introduced
AsCommandattribute works like a charm (as much as the whole 5.3 release 👌). Thanks a lot for that!Though, it seems that the
hiddenproperty has been forgotten, whether one set it or not the command only checks the$this->hiddenvalue set from theconfigure()method.For example:
When I run
bash bin/console list appI getI implemented a fix inspired by the
$name/$descriptionproperties.