diff --git a/validation/custom_constraint.rst b/validation/custom_constraint.rst index faee09778b9..d2e7e148266 100644 --- a/validation/custom_constraint.rst +++ b/validation/custom_constraint.rst @@ -115,6 +115,8 @@ You can use custom validators like the ones provided by Symfony itself: .. code-block:: php-annotations // src/Entity/AcmeEntity.php + namespace App\Entity; + use App\Validator\Constraints as AcmeAssert; use Symfony\Component\Validator\Constraints as Assert; @@ -159,6 +161,8 @@ You can use custom validators like the ones provided by Symfony itself: .. code-block:: php // src/Entity/AcmeEntity.php + namespace App\Entity; + use App\Validator\Constraints\ContainsAlphanumeric; use Symfony\Component\Validator\Constraints\NotBlank; use Symfony\Component\Validator\Mapping\ClassMetadata; @@ -249,6 +253,8 @@ not to the property: .. code-block:: php // src/Entity/AcmeEntity.php + namespace App\Entity; + use App\Validator\Constraints\ProtocolClass; use Symfony\Component\Validator\Mapping\ClassMetadata; diff --git a/validation/sequence_provider.rst b/validation/sequence_provider.rst index 98a9389212f..11edc43a7e0 100644 --- a/validation/sequence_provider.rst +++ b/validation/sequence_provider.rst @@ -149,6 +149,9 @@ that group are valid, the second group, ``Strict``, will be validated. You can also define a group sequence in the ``validation_groups`` form option:: + // src/Form/MyType.php + namespace App\Form; + use Symfony\Component\Form\AbstractType; use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Component\Validator\Constraints\GroupSequence; diff --git a/validation/translations.rst b/validation/translations.rst index 33d7afdf384..5c22f9362c3 100644 --- a/validation/translations.rst +++ b/validation/translations.rst @@ -28,6 +28,8 @@ property is not empty, add the following: .. code-block:: php-annotations // src/Entity/Author.php + namespace App\Entity; + use Symfony\Component\Validator\Constraints as Assert; class Author @@ -67,6 +69,7 @@ property is not empty, add the following: .. code-block:: php // src/Entity/Author.php + namespace App\Entity; // ... use Symfony\Component\Validator\Constraints\NotBlank;