Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Hide commands from ApplicationDescriptor, but allow invoking#20029

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

Merged
fabpot merged 14 commits intosymfony:masterfromjwdeitch:patch-2
Oct 5, 2016

Conversation

@jwdeitch
Copy link
Contributor

@jwdeitchjwdeitch commentedSep 22, 2016
edited
Loading

I would like to hide commands from cluttering the descriptors, but still allow their invocation from code or cron.

QA
Branch?master
Bug fix?no
New feature?yes
BC breaks?no
Deprecations?no
Tests pass?yes
Fixed ticketscomma-separated list of tickets fixed by the PR, if any
LicenseMIT
Doc PRreference to the documentation PR, if any

ro0NL, Nicofuma, and javiereguiluz reacted with thumbs up emoji
private$processTitle;
private$aliases =array();
private$definition;
private$hidden;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Should be$this->hidden = false;

* @param bool $hiddenBool To show this command or not
*
* @return Command The current instance
*/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Should be$hidden

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

indeed. Thank you sir


/**
* Sets if the command should be hidden from application inspection.
*
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Derp.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

What aboutTo hide the command in application descriptions.

@ogizanagi
Copy link
Contributor

What about other descriptors ?

@ro0NL
Copy link
Contributor

ro0NL commentedSep 25, 2016
edited
Loading

@ogizanagi
Copy link
Contributor

@ro0NL,@jwdeitch : Oh right. Sorry. PR title & description may be updated I guess then 😉 .

@jwdeitchjwdeitch changed the titleHide commands from TextDescriptor, but allow invokingHide commands from ApplicationDescriptor, but allow invokingSep 25, 2016
@javiereguiluz
Copy link
Member

Could we change the method names to follow the same notation as for services? Instead ofsetHidden() andisHidden() ->setPublic(true / false) andisPublic() ?

@ro0NL
Copy link
Contributor

Maybe if we run a private command it should give you a heads up in verbose mode.. would that be useful?

@jwdeitch
Copy link
ContributorAuthor

Good idea. Should we merge this first then address that? Or I can throw it into this PR

@ogizanagi
Copy link
Contributor

ogizanagi commentedSep 29, 2016
edited
Loading

@jwdeitch : Could you update the test suite (AbstractDescriptorTest) by adding a new private command inDescriptorApplication2 ?

ro0NL reacted with thumbs up emoji


/**
* To hide the command in application descriptions.
*
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I'd suggest something like:Whether the command should be publicly shown or not. and remove the above description (which brings nothing more IMHO).


/**
* Returns if the command is public in application descriptions.
*
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Same. I feel this repetition is useless.

* @return Command The current instance
*/
publicfunctionsetPublic($public)
{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

should be$this->public = (bool) $public;

* @param bool $public Whether the command should be publicly shown or not.
*
* @return Command The current instance
*/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

What aboutsetPrivate() without an argument? I don't see a need to switch from private to public.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I suggested changing it tosetPublic(false) to mimic Symfony services ... where you must setpublic: false for private services. If we use opposing techniques to do the same (public: false for services,private: true for commands) we're increasing the learning curve.

ro0NL and apfelbox reacted with thumbs up emoji
Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

we could meet in the middle atsetPublicity as it's not favoring one way or another :)

@fabpot
Copy link
Member

Thank you@jwdeitch.

@fabpotfabpot merged commit746dab3 intosymfony:masterOct 5, 2016
fabpot added a commit that referenced this pull requestOct 5, 2016
…voking (jwdeitch, Jordan Deitch)This PR was merged into the 3.2-dev branch.Discussion----------Hide commands from ApplicationDescriptor, but allow invokingI would like to hide commands from cluttering the descriptors, but still allow their invocation from code or cron.| Q             | A| ------------- | ---| Branch?       | master| Bug fix?      | no| New feature?  | yes| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets | comma-separated list of tickets fixed by the PR, if any| License       | MIT| Doc PR        | reference to the documentation PR, if anyCommits-------746dab3 casting setPublic() arg to bool0a3c290 update docblocks and added test6d87837 Update ApplicationDescription.phpe969581 update hidden to public3efa874 Update Command.phpdfc1ac8 Update Command.phpcd77139 Update Command.php56a8b93 Update Command.phpfb1f30c Update Command.php1993196 Update Command.php1add2ad Update Command.phpb73f494 Update ApplicationDescription.php8d0262f Update Command.phpb423ab4 Add hidden field
@wouterj
Copy link
Member

wouterj commentedOct 20, 2016
edited
Loading

I think calling thisprivate will introduce the same confusion that was just solved with the services: I expect I cannot run private commands outside the app, but I still can. It's simply only hidden in the command listing.

Calling thishidden does a better job in describing the feature imo.

@fabpot
Copy link
Member

I tend to agree with@wouterj. A private command is indeed not really private in the same sense as for the container, it's just hidden from the list of commands and can still be executed like any other commands.@javiereguiluz WDYT?

@javiereguiluz
Copy link
Member

I understand "private" as something hidden, secret, confidential, special. Those are precisely thesynonyms of the "private" word. If we talk about commands that cannot be executed outside the app, to me that would be: "banned", "secured", "disabled", "closed", etc.

But if this is confusing to others, then "hidden" is also a very understandable name for this feature.

@stof
Copy link
Member

@javiereguiluz the confusion is that it has a different behavior thanprivate in the DI component:

  • in DI, a private service can be injected into other services, but cannot be accessed from the outside of the container
  • in console, a private command can be called like any other command, as long as you know it exists.

@xabbuh
Copy link
Member

I agree with@wouterj and@fabpot. I opened#20266 which would rename$public to$hidden.

fabpot added a commit that referenced this pull requestOct 21, 2016
…xabbuh)This PR was merged into the 3.2-dev branch.Discussion----------[Console] rename Command::private to Command::hidden| Q             | A| ------------- | ---| Branch?       | master| Bug fix?      | no| New feature?  | no| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets |#20029| License       | MIT| Doc PR        |Commits-------f900ef0 rename Command::private to Command::hidden
@fabpotfabpot mentioned this pull requestOct 27, 2016
xabbuh added a commit to symfony/symfony-docs that referenced this pull requestJan 10, 2017
…eguiluz, wouterj)This PR was submitted for the master branch but it was merged into the 3.2 branch instead (closes#7052).Discussion----------Added an article about private console commandsThis documentssymfony/symfony#20029.Commits-------d1cb043 Reflect private to hidden renaming in the file name01f474f Reflect renaming from private to hidden9415643 Added an article about private console commands
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@fabpotfabpotfabpot left review comments

@javiereguiluzjaviereguiluzjaviereguiluz left review comments

+2 more reviewers

@ro0NLro0NLro0NL left review comments

@ogizanagiogizanagiogizanagi requested changes

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

9 participants

@jwdeitch@ogizanagi@ro0NL@javiereguiluz@fabpot@wouterj@stof@xabbuh@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp