From 7893359c9c6f14b630b957fc16c4a3d853c82c5b Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Fri, 16 Oct 2015 08:58:52 +0200 Subject: [PATCH 1/2] Minor tweaks for the registration form article --- cookbook/doctrine/registration_form.rst | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/cookbook/doctrine/registration_form.rst b/cookbook/doctrine/registration_form.rst index 956026248c1..54f45da9835 100644 --- a/cookbook/doctrine/registration_form.rst +++ b/cookbook/doctrine/registration_form.rst @@ -19,12 +19,12 @@ first start with :doc:`/cookbook/security/entity_provider`. Your ``User`` entity will probably at least have the following fields: -``username`` +* ``username`` This will be used for logging in, unless you instead want your user to :ref:`login via email ` (in that case, this field is unnecessary). -``email`` +* ``email`` A nice piece of information to collect. You can also allow users to :ref:`login via email `. @@ -49,7 +49,7 @@ With some validation added, your class may look something like this:: /** * @ORM\Entity * @UniqueEntity(fields="email", message="Email already taken") - * @UniqueEntity(fields="username", message="Username already taken") + * @UniqueEntity(fields="username", message="Username already taken") */ class User implements UserInterface { @@ -253,7 +253,7 @@ controller for displaying the registration form:: If you decide to NOT use annotation routing (shown above), then you'll need to create a route to this controller: - + .. configuration-block:: .. code-block:: yaml @@ -296,7 +296,7 @@ Next, create the template: .. code-block:: html+jinja {# app/Resources/views/registration/register.html.twig #} - + {{ form_start(form) }} {{ form_row('form.username') }} {{ form_row('form.email') }} @@ -305,7 +305,7 @@ Next, create the template: {{ form_end(form) }} - + .. code-block:: html+php @@ -370,8 +370,8 @@ registration form. The only trick is that you want to add this field to your for without adding an unnecessary new ``termsAccepted`` property to your ``User`` entity that you'll never need. -To do this, add a ``termsAccepted`` field to your form, but set its :ref:`mapped ` -option to ``false``:: +To do this, add a ``termsAccepted`` field to your form, but set its +:ref:`mapped ` option to ``false``:: // src/AppBundle/Form/UserType.php // ... From 09e22aacb68c1497600f24f756fc22e3dc7fb439 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Sat, 17 Oct 2015 12:30:27 +0200 Subject: [PATCH 2/2] Use a definition list for the entity fields --- cookbook/doctrine/registration_form.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cookbook/doctrine/registration_form.rst b/cookbook/doctrine/registration_form.rst index 54f45da9835..b1d76ad4f54 100644 --- a/cookbook/doctrine/registration_form.rst +++ b/cookbook/doctrine/registration_form.rst @@ -19,19 +19,19 @@ first start with :doc:`/cookbook/security/entity_provider`. Your ``User`` entity will probably at least have the following fields: -* ``username`` +``username`` This will be used for logging in, unless you instead want your user to :ref:`login via email ` (in that case, this field is unnecessary). -* ``email`` +``email`` A nice piece of information to collect. You can also allow users to :ref:`login via email `. -* ``password`` +``password`` The encoded password. -* ``plainPassword`` +``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.