Validator\ViolationMapper\ViolationPath (Component\Form\Extension)
Symfony\Component\Form\Extension\Validator\ViolationMapper\ViolationPath
class ViolationPath implements IteratorAggregate, PropertyPathInterface
Methods
__construct(string $violationPath) Creates a new violation path from a string. | ||
string | __toString() Returns the string representation of the property path. | |
int | getLength() Returns the length of the property path, i.e. | |
PropertyPath | getParent() Returns the parent property path. | |
array | getElements() Returns the elements of the property path as array. | |
string | getElement(int $index) Returns the element at the given index in the property path. | |
bool | isProperty(int $index) Returns whether the element at the given index is a property. | |
bool | isIndex(int $index) Returns whether the element at the given index is an array index. | |
bool | mapsForm(int $index) Returns whether an element maps directly to a form. | |
ViolationPathIterator | getIterator() Returns a new iterator for this path. |
Details
public __construct(string $violationPath)
Creates a new violation path from a string.
public string __toString()
Returns the string representation of the property path.
public int getLength()
Returns the length of the property path, i.e.
the number of elements.
public PropertyPath getParent()
Returns the parent property path.
The parent property path is the one that contains the same items as this one except for the last one.
If this property path only contains one item, null is returned.
public array getElements()
Returns the elements of the property path as array.
public string getElement(int $index)
Returns the element at the given index in the property path.
public bool isProperty(int $index)
Returns whether the element at the given index is a property.
public bool isIndex(int $index)
Returns whether the element at the given index is an array index.
public bool mapsForm(int $index)
Returns whether an element maps directly to a form.
Consider the following violation path:
children[address].children[office].data.street
In this example, "address" and "office" map to forms, while "street does not.
public ViolationPathIterator getIterator()
Returns a new iterator for this path.
© 2004–2016 Fabien Potencier
Licensed under the MIT License.
http://api.symfony.com/3.0/Symfony/Component/Form/Extension/Validator/ViolationMapper/ViolationPath.html