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

Minor tweaks for the registration form article #5794

Closed
wants to merge 2 commits into from
Closed
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
16 changes: 8 additions & 8 deletions cookbook/doctrine/registration_form.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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``
Copy link
Member

Choose a reason for hiding this comment

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

can you please explain why you did this? The previous definition list syntax seems better than the unordered list syntax.

Copy link
Member Author

Choose a reason for hiding this comment

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

If you browse this page (http://symfony.com/doc/current/cookbook/doctrine/registration_form.html) you'll understand why I did this :)

symfony_doc_error

Copy link
Member

Choose a reason for hiding this comment

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

Isn't it better to change the other 2 to be a definition list?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes. Done. Thanks.

This will be used for logging in, unless you instead want your user to
:ref:`login via email <registration-form-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 <registration-form-via-email>`.

Expand All @@ -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
{
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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') }}
Expand All @@ -305,7 +305,7 @@ Next, create the template:

<button type="submit">Register!</button>
{{ form_end(form) }}

.. code-block:: html+php

<!-- app/Resources/views/registration/register.html.php -->
Expand Down Expand Up @@ -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 <reference-form-option-mapped>`
option to ``false``::
To do this, add a ``termsAccepted`` field to your form, but set its
:ref:`mapped <reference-form-option-mapped>` option to ``false``::

// src/AppBundle/Form/UserType.php
// ...
Expand Down