class ObjectArray extends ArrayType (View source)

A datatype that replaces references to entities in arrays with a type/identifier tuple and strips singletons from the data to be stored.

Constants

OBJECTARRAY

Properties

protected PersistenceManagerInterface $persistenceManager
protected ReflectionService $reflectionService

Methods

string
getName()

Gets the name of this type.

string
getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform)

Gets the SQL declaration snippet for a field of this type.

int
getBindingType()

Gets the (preferred) binding type for values of this type that can be used when binding parameters to prepared statements.

array
convertToPHPValue(mixed $value, AbstractPlatform $platform)

Converts a value from its database representation to its PHP representation of this type.

mixed
convertToDatabaseValue(mixed $array, AbstractPlatform $platform)

Converts a value from its PHP representation to its database representation of this type.

void
initializeDependencies()

Fetches dependencies from the static object manager.

void
decodeObjectReferences(array $array)

Traverses the $array and replaces known persisted objects (tuples of type and identifier) with actual instances.

void
encodeObjectReferences(array $array)

Traverses the $array and replaces known persisted objects with a tuple of type and identifier.

Details

string getName()

Gets the name of this type.

Return Value

string

string getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform)

Gets the SQL declaration snippet for a field of this type.

Parameters

array $fieldDeclaration
AbstractPlatform $platform

Return Value

string

int getBindingType()

Gets the (preferred) binding type for values of this type that can be used when binding parameters to prepared statements.

Return Value

int

array convertToPHPValue(mixed $value, AbstractPlatform $platform)

Converts a value from its database representation to its PHP representation of this type.

Parameters

mixed $value

The value to convert.

AbstractPlatform $platform

The currently used database platform.

Return Value

array

The PHP representation of the value.

mixed convertToDatabaseValue(mixed $array, AbstractPlatform $platform)

Converts a value from its PHP representation to its database representation of this type.

Parameters

mixed $array

The value to convert.

AbstractPlatform $platform

The currently used database platform.

Return Value

mixed

The database representation of the value.

protected void initializeDependencies()

Fetches dependencies from the static object manager.

Injection cannot be used, since __construct on Types\Type is final.

Return Value

void

protected void decodeObjectReferences(array $array)

Traverses the $array and replaces known persisted objects (tuples of type and identifier) with actual instances.

Parameters

array $array

Return Value

void

protected void encodeObjectReferences(array $array)

Traverses the $array and replaces known persisted objects with a tuple of type and identifier.

Parameters

array $array

Return Value

void

Exceptions

RuntimeException