RelativePath
extends PropertyPath
in package
Default implementation of {@link PropertyPathInterface}.
Tags
Table of Contents
- SINGULAR_SEPARATOR = '|'
- Character used for separating between plural and singular of an element.
- $elements : array<string|int, mixed>
- The elements of the property path.
- $isIndex : array<string|int, mixed>
- Contains a Boolean for each property in $elements denoting whether this element is an index. It is a property otherwise.
- $length : int
- The number of elements in the property path.
- $pathAsString : string
- String representation of the path.
- $root : mixed
- __construct() : mixed
- Constructs a property path from a string.
- __toString() : string
- Returns the string representation of the property path.
- getElement() : string
- Returns the element at the given index in the property path.
- getElements() : array<string|int, mixed>
- Returns the elements of the property path as array.
- getIterator() : PropertyPathIteratorInterface
- Returns a new iterator for this path.
- getLength() : int
- Returns the length of the property path, i.e. the number of elements.
- getParent() : self|null
- Returns the parent property path.
- getRoot() : FormInterface
- isIndex() : bool
- Returns whether the element at the given index is an array index.
- isProperty() : bool
- Returns whether the element at the given index is a property.
Constants
SINGULAR_SEPARATOR
Character used for separating between plural and singular of an element.
public
mixed
SINGULAR_SEPARATOR
= '|'
Properties
$elements
The elements of the property path.
private
array<string|int, mixed>
$elements
= []
$isIndex
Contains a Boolean for each property in $elements denoting whether this element is an index. It is a property otherwise.
private
array<string|int, mixed>
$isIndex
= []
$length
The number of elements in the property path.
private
int
$length
$pathAsString
String representation of the path.
private
string
$pathAsString
$root
private
mixed
$root
Methods
__construct()
Constructs a property path from a string.
public
__construct(FormInterface $root, string $propertyPath) : mixed
Parameters
- $root : FormInterface
- $propertyPath : string
-
The property path as string or instance
Return values
mixed —__toString()
Returns the string representation of the property path.
public
__toString() : string
Return values
string —The path as string
getElement()
Returns the element at the given index in the property path.
public
getElement(mixed $index) : string
Parameters
- $index : mixed
-
The index key
Return values
string —A property or index name
getElements()
Returns the elements of the property path as array.
public
getElements() : array<string|int, mixed>
Return values
array<string|int, mixed> —An array of property/index names
getIterator()
Returns a new iterator for this path.
public
getIterator() : PropertyPathIteratorInterface
Return values
PropertyPathIteratorInterface —getLength()
Returns the length of the property path, i.e. the number of elements.
public
getLength() : int
Return values
int —The path length
getParent()
Returns the parent property path.
public
getParent() : self|null
Return values
self|null —The parent path or null
getRoot()
public
getRoot() : FormInterface
Return values
FormInterface —isIndex()
Returns whether the element at the given index is an array index.
public
isIndex(mixed $index) : bool
Parameters
- $index : mixed
-
The index in the property path
Return values
bool —Whether the element at this index is an array index
isProperty()
Returns whether the element at the given index is a property.
public
isProperty(mixed $index) : bool
Parameters
- $index : mixed
-
The index in the property path
Return values
bool —Whether the element at this index is a property