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] Prevent fatal error when calling Command::getHelper without helperSet#18635

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

Closed

Conversation

@chalasr
Copy link
Member

@chalasrchalasr commentedApr 25, 2016
edited
Loading

QA
Branch?master
Bug fix?yes
New feature?no
BC breaks?no
Deprecations?no
Tests pass?yes
Fixed tickets#18619
LicenseMIT
Doc PRn/a

Patch attached to#18619

tjaari reacted with thumbs up emoji
@javiereguiluzjaviereguiluz changed the title[Console][#18619] Prevent fatal error when calling Command#getHelper without helperSet[Console] Prevent fatal error when calling Command::getHelper without helperSetApr 25, 2016
publicfunctiongetHelper($name)
{
if (null ===$this->helperSet) {
thrownewLogicException(sprintf('Unable to retrieve helper "%s" because there is no HelperSet defined for this command. Did you forget to call %s#setHelperSet()?',$name,get_class($this)));

Choose a reason for hiding this comment

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

If I'm right, in Symfony we usually use theClass::method syntax instead ofClass#method. So%s#setHelperSet() should be%s::setHelperSet() in this error message.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Thanks! Fixed

@chalasrchalasrforce-pushed thepatch_console_ticket_18619 branch from6b99f20 to50816e2CompareApril 25, 2016 19:55
@nicolas-grekas
Copy link
Member

Could be applied on 2.3 also as bug fix.

@javiereguiluz
Copy link
Member

👍 ... and I agree about merging it on 2.3.

publicfunctiongetHelper($name)
{
if (null ===$this->helperSet) {
thrownewLogicException(sprintf('Unable to retrieve helper "%s" because there is no HelperSet defined for this command. Did you forget to call %s::setHelperSet()?',$name,get_class($this)));
Copy link
Member

Choose a reason for hiding this comment

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

The message can be confusing as you usually do not set the helper set directly on the command, but configure it for the application instead.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

@xabbuh I simplified it by removing theDid you forget... part, let me know if you think that something like:

Did you forget to set an application for your command via Command::setApplication()? You can also set an HelperSet directly from your command using Command::setHelperSet().

Could be helpful. Thanks

Copy link
Member

Choose a reason for hiding this comment

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

The first part (setting the application) can as well be related to the command not being registered at the application (which will then set itself on the command).

Maybe something like:

Did you forget to add your command to the application or to set the application on the command using the setApplication() method? You can also set the HelperSet directly using the setHelperSet() method.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

@xabbuh Updated

@chalasrchalasrforce-pushed thepatch_console_ticket_18619 branch 2 times, most recently fromc232ecb to6045a23CompareMay 2, 2016 14:07
…Helper() without helperSetUse Command::setHelperSet rather than Command#setHelperSet in exception msgSimplify exception messageAdd DidYouForget to exception msg
@chalasrchalasrforce-pushed thepatch_console_ticket_18619 branch from6045a23 toede4d92CompareMay 2, 2016 15:30
@fabpot
Copy link
Member

Thank you@chalasr.

fabpot added a commit that referenced this pull requestMay 13, 2016
…per without helperSet (chalasr)This PR was submitted for the master branch but it was merged into the 2.3 branch instead (closes#18635).Discussion----------[Console] Prevent fatal error when calling Command::getHelper without helperSet| Q             | A| ------------- | ---| Branch?       | master| Bug fix?      | yes| New feature?  | no| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets |#18619| License       | MIT| Doc PR        | n/aPatch attached to#18619Commits-------31285c2 [Console][#18619] Prevent fatal error when calling Command#getHelper() without helperSet
@fabpotfabpot closed thisMay 13, 2016
@fabpotfabpot mentioned this pull requestMay 13, 2016
@fabpotfabpot mentioned this pull requestMay 30, 2016
This was referencedJun 6, 2016
@chalasrchalasr deleted the patch_console_ticket_18619 branchNovember 6, 2016 23:49
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

6 participants

@chalasr@nicolas-grekas@javiereguiluz@fabpot@xabbuh@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp