Skip to content

Commit 0c8c26a

Browse files
authored
[Doctrine] Update doctrine.rst
As the type hinting from setter is available, this example will not work. Even without `declare(strict_types=1);` string which could be convert to integer will work but with it, impossible to run this example, as we will have the error "int" expected.
1 parent 3ca2487 commit 0c8c26a

File tree

1 file changed

+0
-6
lines changed

1 file changed

+0
-6
lines changed

doctrine.rst

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -449,12 +449,6 @@ Consider the following controller code::
449449
public function createProduct(ValidatorInterface $validator): Response
450450
{
451451
$product = new Product();
452-
// This will trigger an error: the column isn't nullable in the database
453-
$product->setName(null);
454-
// This will trigger a type mismatch error: an integer is expected
455-
$product->setPrice('1999');
456-
457-
// ...
458452

459453
$errors = $validator->validate($product);
460454
if (count($errors) > 0) {

0 commit comments

Comments
 (0)