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

Fixes to cookbook/doctrine/registration_form.rst#3615

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

Conversation

Crushnaut
Copy link
Contributor

As I was working through this example I noticed a few issues. Firstly, no button to submit the registration form is ever specified. Secondly, in the accountController the Response object is included, but not needed. Thirdly, the Request object is required in the code block for the method createAction in the accountController.

QA
Doc fix?yes
New docs?no
Applies toall (or 2.3+)
Fixed ticketsnone that I know of

@@ -239,7 +240,7 @@ controller for displaying the registration form::
namespace Acme\AccountBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\Request;
Copy link
Member

Choose a reason for hiding this comment

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

this one can be removed completely, since we do not use that object and you will never need it in this example.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

In the next code block you are instructed to add the createAction to the accountController which has the parameter $request as a Request object.

public function createAction(Request $request)

I think it is easier to just include the use statement when specifying the registerAction, but perhaps it would be better to place a note after the createAction code mentioning that you will need to add a use statement for the Request object.

I guess the other option would be to change the line defining the createAction to something like,

public function createAction(\Symfony\Component\HttpFoundation\Request $request)

Copy link
Member

Choose a reason for hiding this comment

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

Ah, missed that one (it was too far below). Thanks for pointing to it.

Our standard is to remove the use statement here and add it at the top of the next code block (the one with createAction):

useSymfony\Component\HttpFoundation\Request;// ...publicfunction createAction(Request$request){

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Oh that makes sense. Should I cancel this pull request and make up a new one with that change?

Copy link
Member

Choose a reason for hiding this comment

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

No, if you push a new commit with the change to the branch of this PR (fixes_cookbook_doctrine_registration), it'll be updated.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Awesome. Done. Thanks again for the help!

@wouterj
Copy link
Member

👍 great job testing the code!

@weaverryan
Copy link
Member

Great finds - thanks Phil!

weaverryan added a commit that referenced this pull requestFeb 27, 2014
This PR was merged into the 2.3 branch.Discussion----------Fixes to cookbook/doctrine/registration_form.rstAs I was working through this example I noticed a few issues. Firstly, no button to submit the registration form is ever specified. Secondly, in the accountController the Response object is included, but not needed. Thirdly, the Request object is required in the code block for the method createAction in the accountController.| Q             | A| ------------- | ---| Doc fix?      | yes| New docs?     | no| Applies to    | all (or 2.3+)| Fixed tickets | none that I know ofCommits-------b56ab13 Made on additional fix as per previous pull request.adffc6b Fixes to cookbook/doctrine/registration_form.rst
@weaverryanweaverryan merged commitb56ab13 intosymfony:2.3Feb 27, 2014
@CrushnautCrushnaut deleted the fixes_cookbook_doctrine_registration branchFebruary 27, 2014 22:31
@Crushnaut
Copy link
ContributorAuthor

I was just reading the code from this tutorial (http://symfony.com/doc/current/cookbook/doctrine/registration_form.html#handling-the-form-submission) and I noticed you don't even need theregisterAction method in the controller ascreateAction does everything that the register action does, plus it handles the form submission. Would it not be better for simplicities sake to just remove theregisterAction method and just use thecreateAction? Or perhaps place a tip bubble at the end of this section with something towards the effect of, "Hey, if you want you can omit theregisterAction and just usecreateAction to handle the GET and POST methods for your form?"

@xabbuh
Copy link
Member

@Crushnaut Do you mind creating a new issue for this?

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

4 participants
@Crushnaut@wouterj@weaverryan@xabbuh

[8]ページ先頭

©2009-2025 Movatter.jp