Skip to content

Commit 4405199

Browse files
committed
Added some references
1 parent 2754496 commit 4405199

File tree

3 files changed

+15
-10
lines changed

3 files changed

+15
-10
lines changed

components/console/helpers/questionhelper.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,8 @@ method::
353353
of the validator. If the answer is invalid, don't throw exceptions in the
354354
normalizer and let the validator handle those errors.
355355

356+
.. _console-validate-question-answer:
357+
356358
Validating the Answer
357359
---------------------
358360

components/options_resolver.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,8 @@ is thrown::
335335
In sub-classes, you can use :method:`Symfony\\Component\\OptionsResolver\\OptionsResolver::addAllowedTypes`
336336
to add additional allowed types without erasing the ones already set.
337337

338+
.. _optionsresolver-validate-value:
339+
338340
Value Validation
339341
~~~~~~~~~~~~~~~~
340342

validation.rst

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -236,24 +236,25 @@ Inside the template, you can output the list of errors exactly as needed:
236236
Validation Callables
237237
~~~~~~~~~~~~~~~~~~~~
238238

239-
.. versionadded:: 5.1
240-
241-
``Validation::createCallable()`` was introduced in Symfony 5.1.
242-
243-
.. versionadded:: 5.3
244-
245-
``Validation::createValidCallable()`` was introduced in Symfony 5.3.
246-
247239
The ``Validation`` also allows you to create a closure to validate values
248-
against a set of constraints (e.g. in :doc:`Console </components/console/helpers/questionhelper>`
249-
or :doc:`OptionsResolver </components/options_resolver>`):
240+
against a set of constraints (useful for example when
241+
:ref:`validating Console command answers <console-validate-question-answer>` or
242+
when :ref:`validating OptionsResolver values <optionsresolver-validate-value>`):
250243

251244
:method:`Symfony\\Component\\Validator\\Validation::createCallable`
252245
This returns a closure that throws ``ValidationFailedException`` when the
253246
constraints aren't matched.
254247
:method:`Symfony\\Component\\Validator\\Validation::createValidCallable`
255248
This returns a closure that returns ``false`` when the constraints aren't matched.
256249

250+
.. versionadded:: 5.1
251+
252+
``Validation::createCallable()`` was introduced in Symfony 5.1.
253+
254+
.. versionadded:: 5.3
255+
256+
``Validation::createValidCallable()`` was introduced in Symfony 5.3.
257+
257258
.. index::
258259
single: Validation; Constraints
259260

0 commit comments

Comments
 (0)