@@ -28,10 +28,10 @@ Your ``User`` entity will probably at least have the following fields:
|
28 | 28 | A nice piece of information to collect. You can also allow users to
|
29 | 29 | :ref:`login via email <registration-form-via-email>`.
|
30 | 30 |
|
31 |
| -* ``password`` |
| 31 | +``password`` |
32 | 32 | The encoded password.
|
33 | 33 |
|
34 |
| -* ``plainPassword`` |
| 34 | +``plainPassword`` |
35 | 35 | This field is *not* persisted: (notice no ``@ORM\Column`` above it). It
|
36 | 36 | temporarily stores the plain password from the registration form. This field
|
37 | 37 | can be validated then used to populate the ``password`` field.
|
@@ -49,7 +49,7 @@ With some validation added, your class may look something like this::
|
49 | 49 | /**
|
50 | 50 | * @ORM\Entity
|
51 | 51 | * @UniqueEntity(fields="email", message="Email already taken")
|
52 |
| -* @UniqueEntity(fields="username", message="Username already taken") |
| 52 | +* @UniqueEntity(fields="username", message="Username already taken") |
53 | 53 | */
|
54 | 54 | class User implements UserInterface
|
55 | 55 | {
|
@@ -163,8 +163,8 @@ Next, create the form for the ``User`` entity::
|
163 | 163 | public function buildForm(FormBuilderInterface $builder, array $options)
|
164 | 164 | {
|
165 | 165 | $builder
|
166 |
| -->add('email', 'email'); |
167 |
| -->add('username', 'text'); |
| 166 | +->add('email', 'email') |
| 167 | +->add('username', 'text') |
168 | 168 | ->add('plainPassword', 'repeated', array(
|
169 | 169 | 'type' => 'password',
|
170 | 170 | 'first_options' => array('label' => 'Password'),
|
@@ -250,7 +250,7 @@ controller for displaying the registration form::
|
250 | 250 |
|
251 | 251 | If you decide to NOT use annotation routing (shown above), then you'll
|
252 | 252 | need to create a route to this controller:
|
253 |
| -
|
| 253 | + |
254 | 254 | .. configuration-block::
|
255 | 255 |
|
256 | 256 | .. code-block:: yaml
|
@@ -293,7 +293,7 @@ Next, create the template:
|
293 | 293 | .. code-block:: html+jinja
|
294 | 294 |
|
295 | 295 | {# app/Resources/views/registration/register.html.twig #}
|
296 |
| -
|
| 296 | + |
297 | 297 | {{ form_start(form) }}
|
298 | 298 | {{ form_row('form.username') }}
|
299 | 299 | {{ form_row('form.email') }}
|
@@ -302,7 +302,7 @@ Next, create the template:
|
302 | 302 |
|
303 | 303 | <button type="submit">Register!</button>
|
304 | 304 | {{ form_end(form) }}
|
305 |
| -
|
| 305 | + |
306 | 306 | .. code-block:: html+php
|
307 | 307 |
|
308 | 308 | <!-- app/Resources/views/registration/register.html.php -->
|
@@ -367,12 +367,12 @@ registration form. The only trick is that you want to add this field to your for
|
367 | 367 | without adding an unnecessary new ``termsAccepted`` property to your ``User`` entity
|
368 | 368 | that you'll never need.
|
369 | 369 |
|
370 |
| -To do this, add a ``termsAccepted`` field to your form, but set its :ref:`mapped <reference-form-option-mapped>` |
371 |
| -option to ``false``:: |
| 370 | +To do this, add a ``termsAccepted`` field to your form, but set its |
| 371 | +:ref:`mapped <reference-form-option-mapped>` option to ``false``:: |
372 | 372 |
|
373 | 373 | // src/AppBundle/Form/UserType.php
|
374 | 374 | // ...
|
375 |
| -use Symfony\\Component\\Validator\\Constraints\\IsTrue; |
| 375 | +use Symfony\Component\Validator\Constraints\IsTrue; |
376 | 376 |
|
377 | 377 | class UserType extends AbstractType
|
378 | 378 | {
|
|
0 commit comments