Documentation

ConstraintViolationBuilderInterface

Builds {@link \Symfony\Component\Validator\ConstraintViolationInterface} objects.

Use the various methods on this interface to configure the built violation. Finally, call to add the violation to the current execution context.

Tags
author

Bernhard Schussek bschussek@gmail.com

Table of Contents

Methods

addViolation()  : mixed
Adds the violation to the current execution context.
atPath()  : $this
Stores the property path at which the violation should be generated.
setCause()  : $this
Sets the cause of the violation.
setCode()  : $this
Sets the violation code.
setInvalidValue()  : $this
Sets the invalid value that caused this violation.
setParameter()  : $this
Sets a parameter to be inserted into the violation message.
setParameters()  : $this
Sets all parameters to be inserted into the violation message.
setPlural()  : $this
Sets the number which determines how the plural form of the violation message is chosen when it is translated.
setTranslationDomain()  : $this
Sets the translation domain which should be used for translating the violation message.

Methods

atPath()

Stores the property path at which the violation should be generated.

public atPath(string $path) : $this

The passed path will be appended to the current property path of the execution context.

Parameters
$path : string

The property path

Return values
$this

setCause()

Sets the cause of the violation.

public setCause(mixed $cause) : $this
Parameters
$cause : mixed

The cause of the violation

Return values
$this

setInvalidValue()

Sets the invalid value that caused this violation.

public setInvalidValue(mixed $invalidValue) : $this
Parameters
$invalidValue : mixed
Return values
$this

setParameter()

Sets a parameter to be inserted into the violation message.

public setParameter(string $key, string $value) : $this
Parameters
$key : string

The name of the parameter

$value : string

The value to be inserted in the parameter's place

Return values
$this

setParameters()

Sets all parameters to be inserted into the violation message.

public setParameters(array<string|int, mixed> $parameters) : $this
Parameters
$parameters : array<string|int, mixed>

An array with the parameter names as keys and the values to be inserted in their place as values

Return values
$this

setTranslationDomain()

Sets the translation domain which should be used for translating the violation message.

public setTranslationDomain(string $translationDomain) : $this
Parameters
$translationDomain : string

The translation domain

Tags
see
TranslatorInterface
Return values
$this

        
On this page

Search results