Skip to content

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

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion cookbook/doctrine/registration_form.rst
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ Next, create the form for this ``Registration`` model::
'checkbox',
array('property_path' => 'termsAccepted')
);
$builder->add('Register', 'submit');
}

public function getName()
Expand All @@ -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
Contributor Author

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):

use Symfony\Component\HttpFoundation\Request;
// ...

public function createAction(Request $request)
{

Copy link
Contributor Author

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
Contributor Author

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!


use Acme\AccountBundle\Form\Type\RegistrationType;
use Acme\AccountBundle\Form\Model\Registration;
Expand Down