PHP Класс Symfony\Component\Form\PropertyPath

Автор: Bernhard Schussek ([email protected])
Наследование: implements IteratorAggregate
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$elements array The elements of the property path
$isIndex array Contains a boolean for each property in $elements denoting whether this element is an index. It is a property otherwise.
$length integer The number of elements in the property path
$string string String representation of the path

Открытые методы

Метод Описание
__construct ( $propertyPath ) Parses the given property path
__toString ( ) : string Returns the string representation of the property path
getElement ( $index ) : string Returns the element at the given index in the property path
getElements ( ) : array Returns the elements of the property path as array
getIterator ( ) : Symfony\Component\Form\PropertyPathIterator Returns a new iterator for this path
getValue ( object | array $objectOrArray ) : mixed Returns the value at the end of the property path of the object
isIndex ( integer $index ) : boolean Returns whether the element at the given index is an array index
isProperty ( integer $index ) : boolean Returns whether the element at the given index is a property
setValue ( object | array &$objectOrArray, $value ) : mixed Sets the value at the end of the property path of the object

Защищенные методы

Метод Описание
camelize ( $property )
readProperty ( object $object, integer $currentIndex ) : mixed Reads the value of the property at the given index in the path
readPropertyPath ( object | array &$objectOrArray, integer $currentIndex ) : mixed Recursive implementation of getValue()
updateProperty ( &$objectOrArray, integer $currentIndex, mixed $value ) Sets the value of the property at the given index in the path
updatePropertyPath ( object | array &$objectOrArray, integer $currentIndex, mixed $value ) Recursive implementation of setValue()

Описание методов

__construct() публичный Метод

Parses the given property path
public __construct ( $propertyPath )

__toString() публичный Метод

Returns the string representation of the property path
public __toString ( ) : string
Результат string

camelize() защищенный Метод

protected camelize ( $property )

getElement() публичный Метод

Returns the element at the given index in the property path
public getElement ( $index ) : string
Результат string A property or index name

getElements() публичный Метод

Returns the elements of the property path as array
public getElements ( ) : array
Результат array An array of property/index names

getIterator() публичный Метод

Returns a new iterator for this path
public getIterator ( ) : Symfony\Component\Form\PropertyPathIterator
Результат Symfony\Component\Form\PropertyPathIterator

getValue() публичный Метод

Example: $path = new PropertyPath('child.name'); echo $path->getValue($object); equals echo $object->getChild()->getName(); This method first tries to find a public getter for each property in the path. The name of the getter must be the camel-cased property name prefixed with "get" or "is". If the getter does not exist, this method tries to find a public property. The value of the property is then returned. If neither is found, an exception is thrown.
public getValue ( object | array $objectOrArray ) : mixed
$objectOrArray object | array The object or array to traverse
Результат mixed The value at the end of the property path

isIndex() публичный Метод

Returns whether the element at the given index is an array index
public isIndex ( integer $index ) : boolean
$index integer The index in the property path
Результат boolean Whether the element at this index is an array index

isProperty() публичный Метод

Returns whether the element at the given index is a property
public isProperty ( integer $index ) : boolean
$index integer The index in the property path
Результат boolean Whether the element at this index is a property

readProperty() защищенный Метод

Reads the value of the property at the given index in the path
protected readProperty ( object $object, integer $currentIndex ) : mixed
$object object The object to read from
$currentIndex integer The index of the read property in the path
Результат mixed The value of the property

readPropertyPath() защищенный Метод

Recursive implementation of getValue()
protected readPropertyPath ( object | array &$objectOrArray, integer $currentIndex ) : mixed
$objectOrArray object | array The object or array to traverse
$currentIndex integer The current index in the property path
Результат mixed The value at the end of the path

setValue() публичный Метод

Example: $path = new PropertyPath('child.name'); echo $path->setValue($object, 'Fabien'); equals echo $object->getChild()->setName('Fabien'); This method first tries to find a public setter for each property in the path. The name of the setter must be the camel-cased property name prefixed with "set". If the setter does not exist, this method tries to find a public property. The value of the property is then changed. If neither is found, an exception is thrown.
public setValue ( object | array &$objectOrArray, $value ) : mixed
$objectOrArray object | array The object or array to traverse
Результат mixed The value at the end of the property path

updateProperty() защищенный Метод

Sets the value of the property at the given index in the path
protected updateProperty ( &$objectOrArray, integer $currentIndex, mixed $value )
$currentIndex integer The index of the modified property in the path
$value mixed The value to set

updatePropertyPath() защищенный Метод

Recursive implementation of setValue()
protected updatePropertyPath ( object | array &$objectOrArray, integer $currentIndex, mixed $value )
$objectOrArray object | array The object or array to traverse
$currentIndex integer The current index in the property path
$value mixed The value to set at the end of the property path

Описание свойств

$elements защищенное свойство

The elements of the property path
protected array $elements
Результат array

$isIndex защищенное свойство

Contains a boolean for each property in $elements denoting whether this element is an index. It is a property otherwise.
protected array $isIndex
Результат array

$length защищенное свойство

The number of elements in the property path
protected int $length
Результат integer

$string защищенное свойство

String representation of the path
protected string $string
Результат string