@@ -233,11 +233,11 @@ then your validator is already registered as a service and :doc:`tagged </servic
233233with the necessary ``validator.constraint_validator ``. This means you can
234234:ref: `inject services or configuration <services-constructor-injection >` like any other service.
235235
236- Constraint Validators with custom options
236+ Constraint Validators with Custom Options
237237~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
238238
239- Define public properties on the constraint class for the desired configuration
240- options:
239+ If you want to add some configuration options to your custom constraint, first
240+ define those options as public properties on the constraint class :
241241
242242.. configuration-block ::
243243
@@ -338,13 +338,14 @@ options:
338338 }
339339 }
340340
341- Inside the validator, options can be accessed quite simple::
341+ Then, inside the validator class you can access these options directly via the
342+ constraint class passes to the ``validate() `` method::
342343
343344 class FooValidator extends ConstraintValidator
344345 {
345346 public function validate($value, Constraint $constraint)
346347 {
347- // Access the option of the constraint
348+ // access any option of the constraint
348349 if ($constraint->optionalBarOption) {
349350 // ...
350351 }
@@ -353,8 +354,8 @@ Inside the validator, options can be accessed quite simple::
353354 }
354355 }
355356
356- Custom options can be passed to the constraints like for the ones provided by Symfony
357- itself :
357+ When using this constraint in your own application, you can pass the value of
358+ the custom options like you pass any other option in built-in constraints :
358359
359360.. configuration-block ::
360361
0 commit comments