@@ -56,6 +56,8 @@ following:
56
56
.. code-block :: php-annotations
57
57
58
58
// src/Acme/BlogBundle/Entity/Author.php
59
+
60
+ // ...
59
61
use Symfony\Component\Validator\Constraints as Assert;
60
62
61
63
class Author
@@ -85,6 +87,7 @@ following:
85
87
86
88
// src/Acme/BlogBundle/Entity/Author.php
87
89
90
+ // ...
88
91
use Symfony\Component\Validator\Mapping\ClassMetadata;
89
92
use Symfony\Component\Validator\Constraints\NotBlank;
90
93
@@ -118,9 +121,9 @@ simple example from inside a controller:
118
121
119
122
.. code-block :: php
120
123
124
+ // ...
121
125
use Symfony\Component\HttpFoundation\Response;
122
126
use Acme\BlogBundle\Entity\Author;
123
- // ...
124
127
125
128
public function indexAction()
126
129
{
@@ -174,7 +177,6 @@ Inside the template, you can output the list of errors exactly as needed:
174
177
.. code-block :: html+jinja
175
178
176
179
{# src/Acme/BlogBundle/Resources/views/Author/validate.html.twig #}
177
-
178
180
<h3>The author has the following errors</h3>
179
181
<ul>
180
182
{% for error in errors %}
@@ -185,7 +187,6 @@ Inside the template, you can output the list of errors exactly as needed:
185
187
.. code-block :: html+php
186
188
187
189
<!-- src/Acme/BlogBundle/Resources/views/Author/validate.html.php -->
188
-
189
190
<h3>The author has the following errors</h3>
190
191
<ul>
191
192
<?php foreach ($errors as $error): ?>
@@ -214,10 +215,10 @@ and bound. The constraint violations on the object are converted into ``FieldErr
214
215
objects that can easily be displayed with your form. The typical form submission
215
216
workflow looks like the following from inside a controller::
216
217
218
+ // ...
217
219
use Acme\BlogBundle\Entity\Author;
218
220
use Acme\BlogBundle\Form\AuthorType;
219
221
use Symfony\Component\HttpFoundation\Request;
220
- // ...
221
222
222
223
public function updateAction(Request $request)
223
224
{
@@ -230,7 +231,7 @@ workflow looks like the following from inside a controller::
230
231
if ($form->isValid()) {
231
232
// the validation passed, do something with the $author object
232
233
233
- return $this->redirect($this->generateUrl(' ...' ));
234
+ return $this->redirect($this->generateUrl(...));
234
235
}
235
236
}
236
237
@@ -370,6 +371,8 @@ constraint, have several configuration options available. Suppose that the
370
371
.. code-block :: php
371
372
372
373
// src/Acme/BlogBundle/Entity/Author.php
374
+
375
+ // ...
373
376
use Symfony\Component\Validator\Mapping\ClassMetadata;
374
377
use Symfony\Component\Validator\Constraints\NotBlank;
375
378
@@ -406,6 +409,8 @@ options can be specified in this way.
406
409
.. code-block :: php-annotations
407
410
408
411
// src/Acme/BlogBundle/Entity/Author.php
412
+
413
+ // ...
409
414
use Symfony\Component\Validator\Constraints as Assert;
410
415
411
416
class Author
@@ -437,6 +442,8 @@ options can be specified in this way.
437
442
.. code-block :: php
438
443
439
444
// src/Acme/BlogBundle/Entity/Author.php
445
+
446
+ // ...
440
447
use Symfony\Component\Validator\Mapping\ClassMetadata;
441
448
use Symfony\Component\Validator\Constraints\Choice;
442
449
@@ -502,6 +509,8 @@ class to have at least 3 characters.
502
509
.. code-block :: php-annotations
503
510
504
511
// Acme/BlogBundle/Entity/Author.php
512
+
513
+ // ...
505
514
use Symfony\Component\Validator\Constraints as Assert;
506
515
507
516
class Author
@@ -526,6 +535,8 @@ class to have at least 3 characters.
526
535
.. code-block :: php
527
536
528
537
// src/Acme/BlogBundle/Entity/Author.php
538
+
539
+ // ...
529
540
use Symfony\Component\Validator\Mapping\ClassMetadata;
530
541
use Symfony\Component\Validator\Constraints\NotBlank;
531
542
use Symfony\Component\Validator\Constraints\MinLength;
@@ -571,6 +582,8 @@ this method must return ``true``:
571
582
.. code-block :: php-annotations
572
583
573
584
// src/Acme/BlogBundle/Entity/Author.php
585
+
586
+ // ...
574
587
use Symfony\Component\Validator\Constraints as Assert;
575
588
576
589
class Author
@@ -598,6 +611,8 @@ this method must return ``true``:
598
611
.. code-block :: php
599
612
600
613
// src/Acme/BlogBundle/Entity/Author.php
614
+
615
+ // ...
601
616
use Symfony\Component\Validator\Mapping\ClassMetadata;
602
617
use Symfony\Component\Validator\Constraints\True;
603
618
@@ -799,7 +814,7 @@ it looks like this::
799
814
// this is *not* a valid email address
800
815
$errorMessage = $errorList[0]->getMessage()
801
816
802
- // do something with the error
817
+ // ... do something with the error
803
818
}
804
819
805
820
// ...
0 commit comments