PHP Class Symfony\Component\PropertyAccess\PropertyAccessor

Author: Bernhard Schussek ([email protected])
Author: Kévin Dunglas ([email protected])
Author: Nicolas Grekas ([email protected])
Inheritance: implements Symfony\Component\PropertyAccess\PropertyAccessorInterface
显示文件 Open project: symfony/symfony Class Usage Examples

Public Methods

Method Description
__construct ( boolean $magicCall = false, boolean $throwExceptionOnInvalidIndex = false, Psr\Cache\CacheItemPoolInterface $cacheItemPool = null ) Should not be used by application code. Use {@link PropertyAccess::createPropertyAccessor()} instead.
createCache ( string $namespace, integer $defaultLifetime, string $version, Psr\Log\LoggerInterface $logger = null ) : Symfony\Component\Cache\Adapter\AdapterInterface Creates the APCu adapter if applicable.
getValue ( $objectOrArray, $propertyPath )
handleError ( $type, $message, $file, $line, $context )
isReadable ( $objectOrArray, $propertyPath )
isWritable ( $objectOrArray, $propertyPath )
setValue ( &$objectOrArray, $propertyPath, $value )

Private Methods

Method Description
camelize ( string $string ) : string Camelizes a given string.
findAdderAndRemover ( ReflectionClass $reflClass, array $singulars ) : array | null Searches for add and remove methods.
getPropertyPath ( string | Symfony\Component\PropertyAccess\PropertyPath $propertyPath ) : Symfony\Component\PropertyAccess\PropertyPath Gets a PropertyPath instance and caches it.
getReadAccessInfo ( string $class, string $property ) : array Guesses how to read the property value.
getWriteAccessInfo ( string $class, string $property, mixed $value ) : array Guesses how to write the property value.
isMethodAccessible ( ReflectionClass $class, string $methodName, integer $parameters ) : boolean Returns whether a method is public and has the number of required parameters.
isPropertyWritable ( object $object, string $property ) : boolean Returns whether a property is writable in the given object.
readIndex ( array $zval, string | integer $index ) : array Reads a key from an array-like structure.
readPropertiesUntil ( array $zval, Symfony\Component\PropertyAccess\PropertyPathInterface $propertyPath, integer $lastIndex, boolean $ignoreInvalidIndices = true ) : array Reads the path from an object up to a given path index.
readProperty ( array $zval, string $property ) : array Reads the a property from an object.
throwInvalidArgumentException ( $message, $trace, $i )
writeCollection ( array $zval, string $property, array | Traversable $collection, string $addMethod, string $removeMethod ) Adjusts a collection-valued property by calling add*() and remove*() methods.
writeIndex ( array $zval, string | integer $index, mixed $value ) Sets the value of an index in a given array-accessible value.
writeProperty ( array $zval, string $property, mixed $value ) Sets the value of a property in the given object.

Method Details

__construct() public method

Should not be used by application code. Use {@link PropertyAccess::createPropertyAccessor()} instead.
public __construct ( boolean $magicCall = false, boolean $throwExceptionOnInvalidIndex = false, Psr\Cache\CacheItemPoolInterface $cacheItemPool = null )
$magicCall boolean
$throwExceptionOnInvalidIndex boolean
$cacheItemPool Psr\Cache\CacheItemPoolInterface

createCache() public static method

Creates the APCu adapter if applicable.
public static createCache ( string $namespace, integer $defaultLifetime, string $version, Psr\Log\LoggerInterface $logger = null ) : Symfony\Component\Cache\Adapter\AdapterInterface
$namespace string
$defaultLifetime integer
$version string
$logger Psr\Log\LoggerInterface
return Symfony\Component\Cache\Adapter\AdapterInterface

getValue() public method

public getValue ( $objectOrArray, $propertyPath )

handleError() public static method

public static handleError ( $type, $message, $file, $line, $context )

isReadable() public method

public isReadable ( $objectOrArray, $propertyPath )

isWritable() public method

public isWritable ( $objectOrArray, $propertyPath )

setValue() public method

public setValue ( &$objectOrArray, $propertyPath, $value )