File tree Expand file tree Collapse file tree 3 files changed +13
-6
lines changed
Filter options
Expand file tree Collapse file tree 3 files changed +13
-6
lines changed
Original file line number Diff line number Diff line change @@ -179,7 +179,9 @@ allows you to return a list of extensions to register::
179
179
// ...
180
180
use AppBundle\Form\Type\TestedType;
181
181
use Symfony\Component\Form\Extension\Validator\ValidatorExtension;
182
+ use Symfony\Component\Form\Form;
182
183
use Symfony\Component\Validator\ConstraintViolationList;
184
+ use Symfony\Component\Validator\Mapping\ClassMetadata;
183
185
use Symfony\Component\Validator\Validator\ValidatorInterface;
184
186
185
187
class TestedTypeTest extends TypeTestCase
@@ -194,6 +196,9 @@ allows you to return a list of extensions to register::
194
196
$this->validator
195
197
->method('validate')
196
198
->will($this->returnValue(new ConstraintViolationList()));
199
+ $validator
200
+ ->method('getMetadataFor')
201
+ ->will($this->returnValue(new ClassMetadata(Form::class)));
197
202
198
203
return array(
199
204
new ValidatorExtension($this->validator),
Original file line number Diff line number Diff line change @@ -50,8 +50,8 @@ following script to determine your web server user and grant the needed permissi
50
50
51
51
$ HTTPDUSER=$(ps axo user,comm | grep -E '[a]pache|[h]ttpd|[_]www|[w]ww-data|[n]ginx' | grep -v root | head -1 | cut -d\ -f1)
52
52
# if this doesn't work, try adding `-n` option
53
- $ sudo setfacl -R -m u:"$HTTPDUSER":rwX -m u:$(whoami):rwX app/cache app/logs
54
53
$ sudo setfacl -dR -m u:"$HTTPDUSER":rwX -m u:$(whoami):rwX app/cache app/logs
54
+ $ sudo setfacl -R -m u:"$HTTPDUSER":rwX -m u:$(whoami):rwX app/cache app/logs
55
55
56
56
.. note ::
57
57
Original file line number Diff line number Diff line change @@ -84,14 +84,13 @@ property is not empty, add the following:
84
84
}
85
85
}
86
86
87
- Create a translation file under the ``validators `` catalog for the constraint
88
- messages, typically in the ``Resources/translations/ `` directory of the bundle.
87
+ Now, create a ``validators `` catalog file in the ``app/Resources/translations `` directory:
89
88
90
89
.. configuration-block ::
91
90
92
91
.. code-block :: xml
93
92
94
- <!-- validators.en.xlf -->
93
+ <!-- app/Resources/translations/ validators.en.xlf -->
95
94
<?xml version =" 1.0" ?>
96
95
<xliff version =" 1.2" xmlns =" urn:oasis:names:tc:xliff:document:1.2" >
97
96
<file source-language =" en" datatype =" plaintext" original =" file.ext" >
@@ -106,12 +105,15 @@ messages, typically in the ``Resources/translations/`` directory of the bundle.
106
105
107
106
.. code-block :: yaml
108
107
109
- # validators.en.yml
108
+ # app/Resources/translations/ validators.en.yml
110
109
author.name.not_blank : Please enter an author name.
111
110
112
111
.. code-block :: php
113
112
114
- // validators.en.php
113
+ // app/Resources/translations/ validators.en.php
115
114
return array(
116
115
'author.name.not_blank' => 'Please enter an author name.',
117
116
);
117
+
118
+ You may need to clear your cache (even in the dev environment) after creating this
119
+ file for the first time.
You can’t perform that action at this time.
0 commit comments