\Symfony\Component\PropertyAccessPropertyPath

Default implementation of {@link PropertyPathInterface}.

Summary

Methods
Properties
Constants
__construct()
__toString()
getLength()
getParent()
getIterator()
getElements()
getElement()
isProperty()
isIndex()
No public properties found
SINGULAR_SEPARATOR
No protected methods found
No protected properties found
N/A
No private methods found
$elements
$length
$isIndex
$pathAsString
N/A

Constants

SINGULAR_SEPARATOR

SINGULAR_SEPARATOR = '|'

Character used for separating between plural and singular of an element.

Properties

$elements

$elements : array

The elements of the property path.

Type

array

$length

$length : integer

The number of elements in the property path.

Type

integer

$isIndex

$isIndex : array

Contains a Boolean for each property in $elements denoting whether this element is an index. It is a property otherwise.

Type

array

$pathAsString

$pathAsString : string

String representation of the path.

Type

string

Methods

__construct()

__construct(\Symfony\Component\PropertyAccess\PropertyPath|string  $propertyPath) 

Constructs a property path from a string.

Parameters

\Symfony\Component\PropertyAccess\PropertyPath|string $propertyPath

The property path as string or instance

Throws

\Symfony\Component\PropertyAccess\Exception\InvalidArgumentException

If the given path is not a string

\Symfony\Component\PropertyAccess\Exception\InvalidPropertyPathException

If the syntax of the property path is not valid

__toString()

__toString() : string

Returns the string representation of the property path.

Returns

string —

The path as string

getLength()

getLength() : integer

Returns the length of the property path, i.e. the number of elements.

Returns

integer —

The path length

getParent()

getParent() : \Symfony\Component\PropertyAccess\PropertyPath

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.

Returns

\Symfony\Component\PropertyAccess\PropertyPath

The parent path or null

getElements()

getElements() : array

Returns the elements of the property path as array.

Returns

array —

An array of property/index names

getElement()

getElement(integer  $index) : string

Returns the element at the given index in the property path.

Parameters

integer $index

The index key

Returns

string —

A property or index name

isProperty()

isProperty(integer  $index) : boolean

Returns whether the element at the given index is a property.

Parameters

integer $index

The index in the property path

Returns

boolean —

Whether the element at this index is a property

isIndex()

isIndex(integer  $index) : boolean

Returns whether the element at the given index is an array index.

Parameters

integer $index

The index in the property path

Returns

boolean —

Whether the element at this index is an array index