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.

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.

count()

{@inheritdoc}

offsetExists($offset)

{@inheritdoc}

offsetGet($offset)

{@inheritdoc}

offsetSet($offset, $violation)

{@inheritdoc}

offsetUnset($offset)

{@inheritdoc}

findByCodes(string|string[] $codes)

Creates iterator for errors with specific codes.

Details

at line line 31
__construct(array $violations = array())

Creates a new constraint violation list.

Parameters

array $violations The constraint violations to add to the list

at line line 43
string __toString()

Converts the violation into a string for debugging purposes.

Return Value

string The violation as string

at line line 57
add(ConstraintViolationInterface $violation)

Adds a constraint violation to this list.

Parameters

ConstraintViolationInterface $violation The violation to add

at line line 65
addAll(ConstraintViolationListInterface $otherList)

Merges an existing violation list into this list.

Parameters

ConstraintViolationListInterface $otherList The list to merge

at line line 75
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.

at line line 87
bool has(int $offset)

Returns whether the given offset exists.

Parameters

int $offset The violation offset

Return Value

bool Whether the offset exists

at line line 95
set(int $offset, ConstraintViolationInterface $violation)

Sets a violation at a given offset.

Parameters

int $offset The violation offset
ConstraintViolationInterface $violation The violation

at line line 103
remove(int $offset)

Removes a violation at a given offset.

Parameters

int $offset The offset to remove

at line line 113
ArrayIterator|ConstraintViolationInterface[] getIterator()

{@inheritdoc}

at line line 121
count()

{@inheritdoc}

at line line 129
offsetExists($offset)

{@inheritdoc}

Parameters

$offset

at line line 137
offsetGet($offset)

{@inheritdoc}

Parameters

$offset

at line line 145
offsetSet($offset, $violation)

{@inheritdoc}

Parameters

$offset
$violation

at line line 157
offsetUnset($offset)

{@inheritdoc}

Parameters

$offset

at line line 169
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.