Skip to content

Commit d19ade7

Browse files
committed
minor #8931 Use ValidatorInterface (giansalex)
This PR was merged into the 4.0 branch. Discussion ---------- Use ValidatorInterface Commits ------- d1b4f9c use ValidatorInterface
2 parents 0278c62 + d1b4f9c commit d19ade7

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)