Skip to content

Commit

Permalink
some tweaks to the Doctrine registration article
Browse files Browse the repository at this point in the history
  • Loading branch information
xabbuh committed Feb 10, 2016
1 parent 66f035b commit 999e783
Showing 1 changed file with 12 additions and 11 deletions.
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;

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

0 comments on commit 999e783

Please sign in to comment.