ConstraintViolationList
class ConstraintViolationList implements IteratorAggregate, ConstraintViolationListInterface
Default implementation of {@ConstraintViolationListInterface}.
Methods
__construct(array $violations = array()) Creates a new constraint violation list. | ||
string | __toString() Converts the violation into a string for debugging purposes. | |
add(ConstraintViolationInterface $violation) Adds a constraint violation to this list. | ||
addAll(ConstraintViolationListInterface $otherList) Merges an existing violation list into this list. | ||
ConstraintViolationInterface | get(int $offset) Returns the violation at a given offset. | |
bool | has(int $offset) Returns whether the given offset exists. | |
set(int $offset, ConstraintViolationInterface $violation) Sets a violation at a given offset. | ||
remove(int $offset) Removes a violation at a given offset. | ||
ArrayIterator|ConstraintViolationInterface[] | getIterator() {@inheritdoc} | |
count() {@inheritdoc} | ||
offsetExists($offset) {@inheritdoc} | ||
offsetGet($offset) {@inheritdoc} | ||
offsetSet($offset, $violation) {@inheritdoc} | ||
offsetUnset($offset) {@inheritdoc} | ||
ConstraintViolationList | findByCodes(string|string[] $codes) Creates iterator for errors with specific codes. |
Details
__construct(array $violations = array())
Creates a new constraint violation list.
Parameters
array | $violations | The constraint violations to add to the list |
string __toString()
Converts the violation into a string for debugging purposes.
Return Value
string | The violation as string |
add(ConstraintViolationInterface $violation)
Adds a constraint violation to this list.
Parameters
ConstraintViolationInterface | $violation | The violation to add |
addAll(ConstraintViolationListInterface $otherList)
Merges an existing violation list into this list.
Parameters
ConstraintViolationListInterface | $otherList | The list to merge |
ConstraintViolationInterface get(int $offset)
Returns the violation at a given offset.
Parameters
int | $offset | The offset of the violation |
Return Value
ConstraintViolationInterface | The violation |
Exceptions
OutOfBoundsException | if the offset does not exist |
bool has(int $offset)
Returns whether the given offset exists.
Parameters
int | $offset | The violation offset |
Return Value
bool | Whether the offset exists |
set(int $offset, ConstraintViolationInterface $violation)
Sets a violation at a given offset.
Parameters
int | $offset | The violation offset |
ConstraintViolationInterface | $violation | The violation |
remove(int $offset)
Removes a violation at a given offset.
Parameters
int | $offset | The offset to remove |
ArrayIterator|ConstraintViolationInterface[] getIterator()
{@inheritdoc}
Return Value
ArrayIterator|ConstraintViolationInterface[] |
count()
{@inheritdoc}
offsetExists($offset)
{@inheritdoc}
Parameters
$offset |
offsetGet($offset)
{@inheritdoc}
Parameters
$offset |
offsetSet($offset, $violation)
{@inheritdoc}
Parameters
$offset | ||
$violation |
offsetUnset($offset)
{@inheritdoc}
Parameters
$offset |
ConstraintViolationList findByCodes(string|string[] $codes)
Creates iterator for errors with specific codes.
Parameters
string|string[] | $codes | The codes to find |
Return Value
ConstraintViolationList | new instance which contains only specific errors |
© 2004–2017 Fabien Potencier
Licensed under the MIT License.
http://api.symfony.com/4.0/Symfony/Component/Validator/ConstraintViolationList.html