\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 : int

The number of elements in the property path.

Type

int

$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) : mixed

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

Returns

mixed —

__toString()

__toString() : string

Returns the string representation of the property path.

Returns

string —

The path as string

getLength()

getLength() : int

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

Returns

int —

The path length

getParent()

getParent() : self|null

Returns the parent property path.

Returns

self|null —

The parent path or null

getIterator()

getIterator() : \Symfony\Component\PropertyAccess\PropertyPathIteratorInterface

Returns a new iterator for this path.

Returns

\Symfony\Component\PropertyAccess\PropertyPathIteratorInterface —

getElements()

getElements() : array

Returns the elements of the property path as array.

Returns

array —

An array of property/index names

getElement()

getElement(int  $index) : string

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

Parameters

int $index

The index key

Returns

string —

A property or index name

isProperty()

isProperty(int  $index) : bool

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

Parameters

int $index

The index in the property path

Returns

bool —

Whether the element at this index is a property

isIndex()

isIndex(int  $index) : bool

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

Parameters

int $index

The index in the property path

Returns

bool —

Whether the element at this index is an array index