Skip to content

Commit d1b4f9c

Browse files
authored
use ValidatorInterface
1 parent 600f5ae commit d1b4f9c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

validation.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,16 +129,16 @@ returned. Take this simple example from inside a controller::
129129

130130
// ...
131131
use Symfony\Component\HttpFoundation\Response;
132+
use Symfony\Component\Validator\Validator\ValidatorInterface;
132133
use App\Entity\Author;
133134

134135
// ...
135-
public function author()
136+
public function author(ValidatorInterface $validator)
136137
{
137138
$author = new Author();
138139

139140
// ... do something to the $author object
140141

141-
$validator = $this->get('validator');
142142
$errors = $validator->validate($author);
143143

144144
if (count($errors) > 0) {

0 commit comments

Comments
 (0)