Skip to content
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

[Cookbook][Doctrine] some tweaks to the Doctrine registration article #6255

Merged
merged 1 commit into from
Feb 15, 2016
Merged
Changes from all commits
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
23 changes: 12 additions & 11 deletions cookbook/doctrine/registration_form.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Your ``User`` entity will probably at least have the following fields:
``plainPassword``
This field is *not* persisted: (notice no ``@ORM\Column`` above it). It
temporarily stores the plain password from the registration form. This field
can be validated then used to populate the ``password`` field.
can be validated and is then used to populate the ``password`` field.

With some validation added, your class may look something like this::

Expand Down Expand Up @@ -127,17 +127,18 @@ With some validation added, your class may look something like this::

public function getSalt()
{
// The bcrypt algorithm don't require a separate salt.
// The bcrypt algorithm doesn't require a separate salt.
// You *may* need a real salt if you choose a different encoder.
return null;
}

// other methods, including security methods like getRoles()
}

The ``UserInterface`` requires a few other methods and your ``security.yml`` file
needs to be configured properly to work with the ``User`` entity. For a more full
example, see the :ref:`Entity Provider <security-crete-user-entity>` article.
The :class:`Symfony\\Component\\Security\\Core\\User\\UserInterface` requires
a few other methods and your ``security.yml`` file needs to be configured
properly to work with the ``User`` entity. For a more complete example, see
the :ref:`Entity Provider <security-crete-user-entity>` article.

.. _cookbook-registration-password-max:

Expand Down Expand Up @@ -186,7 +187,7 @@ Next, create the form for the ``User`` entity::
public function setDefaultOptions(OptionsResolverInterface $resolver)
{
$resolver->setDefaults(array(
'data_class' => 'AppBundle\Entity\User'
'data_class' => 'AppBundle\Entity\User',
));
}

Expand All @@ -201,7 +202,8 @@ There are just three fields: ``email``, ``username`` and ``plainPassword``

.. tip::

To explore more things about the Form component, read :doc:`/book/forms`.
To explore more things about the Form component, read the
:doc:`chapter about forms </book/forms>` in the book.

Handling the Form Submission
----------------------------
Expand All @@ -213,10 +215,9 @@ into the database::
// src/AppBundle/Controller/RegistrationController.php
namespace AppBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;

use AppBundle\Form\UserType;
use AppBundle\Entity\User;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
Copy link
Contributor

Choose a reason for hiding this comment

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

"Sensio" could go before "Symfony" to keep the alphabetical order.

Same for line 46 can be the last.

Line 250 "[...] like sending [...] ?
Line 414 shouldn't it be "[...] Symfony knows how to [...]"

Copy link
Member Author

Choose a reason for hiding this comment

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

thanks, I have made these tweaks in 44d7479

Copy link
Contributor

Choose a reason for hiding this comment

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

👍 I was not sure I should mention it


Expand Down Expand Up @@ -376,8 +377,8 @@ See :doc:`/cookbook/form/form_customization` for more details.
Update your Database Schema
---------------------------

If you've updated the User entity during this tutorial, you have to update your
database schema using this command:
If you've updated the ``User`` entity during this tutorial, you have to update
your database schema using this command:

.. code-block:: bash

Expand Down