Constants

DISALLOW_MAGIC_METHODS

DISALLOW_MAGIC_METHODS = \Symfony\Component\PropertyInfo\Extractor\ReflectionExtractor::DISALLOW_MAGIC_METHODS : int

MAGIC_GET

MAGIC_GET = \Symfony\Component\PropertyInfo\Extractor\ReflectionExtractor::ALLOW_MAGIC_GET : int

MAGIC_SET

MAGIC_SET = \Symfony\Component\PropertyInfo\Extractor\ReflectionExtractor::ALLOW_MAGIC_SET : int

MAGIC_CALL

MAGIC_CALL = \Symfony\Component\PropertyInfo\Extractor\ReflectionExtractor::ALLOW_MAGIC_CALL : int

VALUE

VALUE = 0

REF

REF = 1

IS_REF_CHAINED

IS_REF_CHAINED = 2

CACHE_PREFIX_READ

CACHE_PREFIX_READ = 'r'

CACHE_PREFIX_WRITE

CACHE_PREFIX_WRITE = 'w'

CACHE_PREFIX_PROPERTY_PATH

CACHE_PREFIX_PROPERTY_PATH = 'p'

RESULT_PROTO

RESULT_PROTO = [self::VALUE => null]

Properties

$magicMethodsFlags

$magicMethodsFlags

$ignoreInvalidIndices

$ignoreInvalidIndices

$ignoreInvalidProperty

$ignoreInvalidProperty

$propertyPathCache

$propertyPathCache

$readPropertyCache

$readPropertyCache

$writePropertyCache

$writePropertyCache

Methods

__construct()

__construct(int  $magicMethods = self::MAGIC_GET | self::MAGIC_SET, bool  $throwExceptionOnInvalidIndex = false, \Psr\Cache\CacheItemPoolInterface  $cacheItemPool = null, bool  $throwExceptionOnInvalidPropertyPath = true, \Symfony\Component\PropertyInfo\PropertyReadInfoExtractorInterface  $readInfoExtractor = null, \Symfony\Component\PropertyInfo\PropertyWriteInfoExtractorInterface  $writeInfoExtractor = null) : mixed

Should not be used by application code. Use {@link PropertyAccess::createPropertyAccessor()} instead.

Parameters

int $magicMethods

A bitwise combination of the MAGIC_* constants to specify the allowed magic methods (__get, __set, __call) or self::DISALLOW_MAGIC_METHODS for none

bool $throwExceptionOnInvalidIndex
\Psr\Cache\CacheItemPoolInterface $cacheItemPool
bool $throwExceptionOnInvalidPropertyPath
\Symfony\Component\PropertyInfo\PropertyReadInfoExtractorInterface $readInfoExtractor
\Symfony\Component\PropertyInfo\PropertyWriteInfoExtractorInterface $writeInfoExtractor

Returns

mixed —

getValue()

getValue(mixed  $objectOrArray, mixed  $propertyPath) : mixed

Returns the value at the end of the property path of the object graph.

Parameters

mixed $objectOrArray

The object or array to traverse

mixed $propertyPath

The property path to read

Returns

mixed —

The value at the end of the property path

setValue()

setValue(mixed  $objectOrArray, mixed  $propertyPath, mixed  $value) : mixed

Sets the value at the end of the property path of the object graph.

Parameters

mixed $objectOrArray

The object or array to modify

mixed $propertyPath

The property path to modify

mixed $value

The value to set at the end of the property path

Returns

mixed —

isReadable()

isReadable(mixed  $objectOrArray, mixed  $propertyPath) : bool

Returns whether a property path can be read from an object graph.

Parameters

mixed $objectOrArray

The object or array to check

mixed $propertyPath

The property path to check

Returns

bool —

Whether the property path can be read

isWritable()

isWritable(mixed  $objectOrArray, mixed  $propertyPath) : bool

Returns whether a value can be written at a given property path.

Parameters

mixed $objectOrArray

The object or array to check

mixed $propertyPath

The property path to check

Returns

bool —

Whether the value can be set

createCache()

createCache(string  $namespace, int  $defaultLifetime, string  $version, \Psr\Log\LoggerInterface  $logger = null) : \Symfony\Component\Cache\Adapter\AdapterInterface

Creates the APCu adapter if applicable.

Parameters

string $namespace
int $defaultLifetime
string $version
\Psr\Log\LoggerInterface $logger

Throws

\LogicException

When the Cache Component isn't available

Returns

\Symfony\Component\Cache\Adapter\AdapterInterface —

throwInvalidArgumentException()

throwInvalidArgumentException(string  $message, array  $trace, int  $i, string  $propertyPath, \Throwable  $previous = null) : void

Parameters

string $message
array $trace
int $i
string $propertyPath
\Throwable $previous

readPropertiesUntil()

readPropertiesUntil(array  $zval, \Symfony\Component\PropertyAccess\PropertyPathInterface  $propertyPath, int  $lastIndex, bool  $ignoreInvalidIndices = true) : array

Reads the path from an object up to a given path index.

Parameters

array $zval
\Symfony\Component\PropertyAccess\PropertyPathInterface $propertyPath
int $lastIndex
bool $ignoreInvalidIndices

Throws

\Symfony\Component\PropertyAccess\Exception\UnexpectedTypeException

if a value within the path is neither object nor array

\Symfony\Component\PropertyAccess\Exception\NoSuchIndexException

If a non-existing index is accessed

Returns

array —

readIndex()

readIndex(array  $zval, string|int  $index) : array

Reads a key from an array-like structure.

Parameters

array $zval
string|int $index

The key to read

Throws

\Symfony\Component\PropertyAccess\Exception\NoSuchIndexException

If the array does not implement \ArrayAccess or it is not an array

Returns

array —

readProperty()

readProperty(array  $zval, string  $property, bool  $ignoreInvalidProperty = false) : array

Reads the a property from an object.

Parameters

array $zval
string $property
bool $ignoreInvalidProperty

Throws

\Symfony\Component\PropertyAccess\Exception\NoSuchPropertyException

If $ignoreInvalidProperty is false and the property does not exist or is not public

Returns

array —

getReadInfo()

getReadInfo(string  $class, string  $property) : ?\Symfony\Component\PropertyInfo\PropertyReadInfo

Guesses how to read the property value.

Parameters

string $class
string $property

Returns

?\Symfony\Component\PropertyInfo\PropertyReadInfo —

writeIndex()

writeIndex(array  $zval, string|int  $index, mixed  $value) : mixed

Sets the value of an index in a given array-accessible value.

Parameters

array $zval
string|int $index

The index to write at

mixed $value

The value to write

Throws

\Symfony\Component\PropertyAccess\Exception\NoSuchIndexException

If the array does not implement \ArrayAccess or it is not an array

Returns

mixed —

writeProperty()

writeProperty(array  $zval, string  $property, mixed  $value) : mixed

Sets the value of a property in the given object.

Parameters

array $zval
string $property
mixed $value

The value to write

Throws

\Symfony\Component\PropertyAccess\Exception\NoSuchPropertyException

if the property does not exist or is not public

Returns

mixed —

writeCollection()

writeCollection(array  $zval, string  $property, iterable  $collection, \Symfony\Component\PropertyInfo\PropertyWriteInfo  $addMethod, \Symfony\Component\PropertyInfo\PropertyWriteInfo  $removeMethod) : mixed

Adjusts a collection-valued property by calling add*() and remove*() methods.

Parameters

array $zval
string $property
iterable $collection
\Symfony\Component\PropertyInfo\PropertyWriteInfo $addMethod
\Symfony\Component\PropertyInfo\PropertyWriteInfo $removeMethod

Returns

mixed —

getWriteInfo()

getWriteInfo(string  $class, string  $property, mixed  $value) : \Symfony\Component\PropertyInfo\PropertyWriteInfo

Parameters

string $class
string $property
mixed $value

Returns

\Symfony\Component\PropertyInfo\PropertyWriteInfo —

isPropertyWritable()

isPropertyWritable(object  $object, string  $property) : bool

Returns whether a property is writable in the given object.

Parameters

object $object

The object to write to

string $property

Returns

bool —

getPropertyPath()

getPropertyPath(string|\Symfony\Component\PropertyAccess\PropertyPath  $propertyPath) : \Symfony\Component\PropertyAccess\PropertyPath

Gets a PropertyPath instance and caches it.

Parameters

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

Returns

\Symfony\Component\PropertyAccess\PropertyPath —