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

[Console] Fix ability to disable lazy commands#25030

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
nicolas-grekas merged 1 commit intosymfony:3.4fromchalasr:disabled-lazy-command
Nov 19, 2017

Conversation

@chalasr
Copy link
Member

@chalasrchalasr commentedNov 19, 2017
edited
Loading

QA
Branch?3.4
Bug fix?yes
New feature?no
BC breaks?no
Deprecations?no
Tests pass?yes
Fixed ticketsn/a
LicenseMIT
Doc PRn/a

Properly throw when running them and don't show them in the list, as for non lazy ones.

*
* @throws CommandNotFoundException When given command name does not exist
*/
publicfunctionget($name)
Copy link
Contributor

Choose a reason for hiding this comment

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

has() is affected also, which might simplify get() as such

if (!$this->has($name)) {throw...;}$command =$this->commands[$name];

ogizanagi reacted with thumbs up emoji
Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Callinghas() should not initialize the command if it exists to me (onlyget() should do), so unless I'm mistaken, making it return false because!$this->get($name)->isEnabled() would be wrong

Copy link
Contributor

Choose a reason for hiding this comment

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

well.. for non-lazy commands has() returns false in case it's disabled. I dont see a real reason why that wouldnt apply to lazy commands.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

I agree, just feel bad to load beforeget() :)
@ogizanagi agree forApplication::has() callingCommandLoaderInterface::get()?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, it looks the right thing to do to me regarding the existing functional.


$commands =$this->commands;
foreach ($this->commandLoader->getNames()as$name) {
if (!isset($commands[$name])) {
Copy link
Contributor

Choose a reason for hiding this comment

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

what about

if (!isset($commands[$name]) &&$this->has($name)) {$commands[$name] =$this->get($name);}

looks weird, but avoids repeating isEnabled logic here and there.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

👍 done

@nicolas-grekas
Copy link
Member

Thank you@chalasr.

@nicolas-grekasnicolas-grekas merged commit6787d8e intosymfony:3.4Nov 19, 2017
nicolas-grekas added a commit that referenced this pull requestNov 19, 2017
This PR was merged into the 3.4 branch.Discussion----------[Console] Fix ability to disable lazy commands| Q             | A| ------------- | ---| Branch?       | 3.4| Bug fix?      | yes| New feature?  | no| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets | n/a| License       | MIT| Doc PR        | n/aProperly throw when running them and don't show them in the list, as for non lazy ones.Commits-------6787d8e [Console] Fix disabling lazy commands
@chalasrchalasr deleted the disabled-lazy-command branchNovember 19, 2017 19:03
This was referencedNov 21, 2017
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@nicolas-grekasnicolas-grekasnicolas-grekas approved these changes

+2 more reviewers

@ogizanagiogizanagiogizanagi approved these changes

@ro0NLro0NLro0NL approved these changes

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Projects

None yet

Milestone

3.4

Development

Successfully merging this pull request may close these issues.

5 participants

@chalasr@nicolas-grekas@ro0NL@ogizanagi@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp