abstract class AbstractPersistenceManager implements PersistenceManagerInterface (View source)

The Flow Persistence Manager base class

Properties

protected array $settings
protected array $newObjects
protected bool $hasUnpersistedChanges
protected AllowedObjectsContainer $allowedObjects

Methods

void
injectSettings(array $settings)

Injects the Flow settings, the persistence part is kept for further use.

void
clearState()

Clears the in-memory state of the persistence.

void
registerNewObject(PersistenceMagicInterface $object)

Registers an object which has been created or cloned during this request.

void
allowObject(object $object)

Adds the given object to a list of allowed objects which may be persisted even if the current HTTP request is considered a "safe" request.

array
convertObjectToIdentityArray(object $object)

Converts the given object into an array containing the identity of the domain object.

array
convertObjectsToIdentityArrays(array $array)

Recursively iterates through the given array and turns objects into an arrays containing the identity of the domain object.

bool
hasUnpersistedChanges()

Gives feedback if the persistence Manager has unpersisted changes.

Details

void injectSettings(array $settings)

Injects the Flow settings, the persistence part is kept for further use.

Parameters

array $settings

Return Value

void

void clearState()

Clears the in-memory state of the persistence.

Return Value

void

void registerNewObject(PersistenceMagicInterface $object)

Registers an object which has been created or cloned during this request.

The given object must contain the Persistence_Object_Identifier property, thus the PersistenceMagicInterface type hint. A "new" object does not necessarily have to be known by any repository or be persisted in the end.

Objects registered with this method must be known to the getObjectByIdentifier() method.

Parameters

PersistenceMagicInterface $object

The new object to register

Return Value

void

void allowObject(object $object)

Adds the given object to a list of allowed objects which may be persisted even if the current HTTP request is considered a "safe" request.

Parameters

object $object

The object

Return Value

void

array convertObjectToIdentityArray(object $object)

Converts the given object into an array containing the identity of the domain object.

Parameters

object $object

The object to be converted

Return Value

array

The identity array in the format array('__identity' => '...')

Exceptions

UnknownObjectException

array convertObjectsToIdentityArrays(array $array)

Recursively iterates through the given array and turns objects into an arrays containing the identity of the domain object.

Parameters

array $array

The array to be iterated over

Return Value

array

The modified array without objects

Exceptions

UnknownObjectException

bool hasUnpersistedChanges()

Gives feedback if the persistence Manager has unpersisted changes.

This is primarily used to inform the user if he tries to save data in an unsafe request.

Return Value

bool