-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes to cookbook/doctrine/registration_form.rst #3615
Conversation
@@ -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; |
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.
this one can be removed completely, since we do not use that object and you will never need it in this example.
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.
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)
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.
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):
use Symfony\Component\HttpFoundation\Request;
// ...
public function createAction(Request $request)
{
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.
Oh that makes sense. Should I cancel this pull request and make up a new one with that change?
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.
No, if you push a new commit with the change to the branch of this PR (fixes_cookbook_doctrine_registration), it'll be updated.
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.
Awesome. Done. Thanks again for the help!
👍 great job testing the code! |
Great finds - thanks Phil! |
This PR was merged into the 2.3 branch. Discussion ---------- Fixes to cookbook/doctrine/registration_form.rst 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. | Q | A | ------------- | --- | Doc fix? | yes | New docs? | no | Applies to | all (or 2.3+) | Fixed tickets | none that I know of Commits ------- b56ab13 Made on additional fix as per previous pull request. adffc6b Fixes to cookbook/doctrine/registration_form.rst
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 the |
@Crushnaut Do you mind creating a new issue for this? |
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.