class DataMapper (View source)

deprecated since Flow 6.0

A data mapper to map raw records to objects

Properties

protected Session $persistenceSession
protected ReflectionService $reflectionService
protected PersistenceManagerInterface $persistenceManager

Methods

void
injectPersistenceSession(Session $persistenceSession)

Injects the persistence session

void
injectReflectionService(ReflectionService $reflectionService)

Injects a Reflection Service instance used for processing objects

void
setPersistenceManager(PersistenceManagerInterface $persistenceManager)

Injects the persistence manager

array
mapToObjects(array $objectsData)

Maps the (aggregate root) node data and registers the objects as reconstituted with the session.

object
mapToObject(array $objectData)

Maps a single record into the object it represents and registers it as reconstituted with the session.

void
thawProperties(object $object, string $identifier, array $objectData)

Sets the given properties on the object.

mapDateTime(int $timestamp)

Creates a \DateTime from an unix timestamp. If the input is not an integer NULL is returned.

array
mapArray(array $arrayValues = null)

Maps an array proxy structure back to a native PHP array

mapSplObjectStorage(array $objectStorageValues = null, bool $createLazySplObjectStorage = false)

Maps an SplObjectStorage proxy record back to an SplObjectStorage

Details

void injectPersistenceSession(Session $persistenceSession)

Injects the persistence session

Parameters

Session $persistenceSession

The persistence session

Return Value

void

void injectReflectionService(ReflectionService $reflectionService)

Injects a Reflection Service instance used for processing objects

Parameters

ReflectionService $reflectionService

Return Value

void

void setPersistenceManager(PersistenceManagerInterface $persistenceManager)

Injects the persistence manager

Parameters

PersistenceManagerInterface $persistenceManager

The persistence manager

Return Value

void

array mapToObjects(array $objectsData)

Maps the (aggregate root) node data and registers the objects as reconstituted with the session.

Note: QueryResult relies on the fact that the first object of $objects has the numeric index "0"

Parameters

array $objectsData

Return Value

array

object mapToObject(array $objectData)

Maps a single record into the object it represents and registers it as reconstituted with the session.

Parameters

array $objectData

Return Value

object

Exceptions

InvalidObjectDataException
Exception

void thawProperties(object $object, string $identifier, array $objectData)

Sets the given properties on the object.

Parameters

object $object

The object to set properties on

string $identifier

The identifier of the object

array $objectData

Return Value

void

Exceptions

UnknownObjectException

protected DateTime mapDateTime(int $timestamp)

Creates a \DateTime from an unix timestamp. If the input is not an integer NULL is returned.

Parameters

int $timestamp

Return Value

DateTime

protected array mapArray(array $arrayValues = null)

Maps an array proxy structure back to a native PHP array

Parameters

array $arrayValues

Return Value

array

protected SplObjectStorage mapSplObjectStorage(array $objectStorageValues = null, bool $createLazySplObjectStorage = false)

Maps an SplObjectStorage proxy record back to an SplObjectStorage

restore information attached to objects?

Parameters

array $objectStorageValues
bool $createLazySplObjectStorage

Return Value

SplObjectStorage