PHP 클래스 Symfony\Component\Form\Util\PropertyPath

저자: Bernhard Schussek ([email protected])
상속: implements IteratorAggregate
파일 보기 프로젝트 열기: pmjones/php-framework-benchmarks 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$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 ( string $propertyPath ) Parses the given property path
__toString ( ) : string Returns the string representation of the property path
getElement ( integer $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\Util\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, mixed $value ) 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
writeProperty ( object &$objectOrArray, integer $currentIndex, mixed $value ) Sets the value of the property at the given index in the path

메소드 상세

__construct() 공개 메소드

Parses the given property path
public __construct ( string $propertyPath )
$propertyPath string

__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 ( integer $index ) : string
$index integer The index key
리턴 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\Util\PropertyPathIterator
리턴 Symfony\Component\Form\Util\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

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, mixed $value )
$objectOrArray object | array The object or array to traverse
$value mixed The value at the end of the property path

writeProperty() 보호된 메소드

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

프로퍼티 상세

$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