AbstractBackend deprecated
abstract class AbstractBackend implements BackendInterface (View source)
deprecated
An abstract storage backend for the Flow persistence
Constants
OBJECTSTATE_RECONSTITUTED |
An object that was reconstituted |
OBJECTSTATE_NEW |
An object that is new |
Properties
protected ReflectionService | $reflectionService | ||
protected Session | $persistenceSession | ||
protected PersistenceManagerInterface | $persistenceManager | ||
protected ValidatorResolver | $validatorResolver | ||
protected LoggerInterface | $logger | ||
protected SplObjectStorage | $visitedDuringPersistence | ||
protected SplObjectStorage | $aggregateRootObjects | ||
protected SplObjectStorage | $deletedEntities | ||
protected SplObjectStorage | $changedEntities | ||
protected array | $classSchemata |
Methods
Constructs the backend
Injects a Reflection Service instance used for processing objects
Set a PersistenceManager instance.
Injects the (system) logger based on PSR-3.
Signalizes that the given object has been removed
Signalizes that the given object has been persisted
Initializes the backend
Commits the current persistence session.
Returns true, if an active connection to the persistence backend has been established, e.g. entities can be persisted.
First persist new objects, then check reconstituted entities.
Stores or updates an object in the underlying storage.
Actually store an object, backend-specific
Iterate over deleted entities and process them
Remove an entity
Remove a value object
Validates the given object and throws an exception if validation fails.
Returns the type of $value, i.e. the class name or primitive type.
Returns the type name as used in the database table names.
No description
Convert a value to the internal object data format
Remove any unreferenced non aggregate root entity
No description
Check the property value for allowed types and throw exceptions for unsupported types.
Store an array as a set of records, with each array element becoming a property named like the key and the value.
"Serializes" a nested array for storage.
Remove objects removed from array compared to $previousArray.
Checks whether the given object is contained in the array. This checks for object identity in terms of the persistence layer, i.e. the UUID, when comparing entities.
Store an SplObjectStorage as a set of records.
Remove objects removed from SplObjectStorage compared to $previousSplObjectStorage.
Creates a unix timestamp from the given DateTime object. If NULL is given NULL will be returned.
Details
__construct()
Constructs the backend
void
injectReflectionService(ReflectionService $reflectionService)
Injects a Reflection Service instance used for processing objects
void
injectPersistenceSession(Session $persistenceSession)
Injects the persistence session
void
setPersistenceManager(PersistenceManagerInterface $persistenceManager)
Set a PersistenceManager instance.
void
injectValidatorResolver(ValidatorResolver $validatorResolver)
Injects the ValidatorResolver
void
injectLogger(LoggerInterface $logger)
Injects the (system) logger based on PSR-3.
protected void
emitRemovedObject(object $object)
Signalizes that the given object has been removed
protected void
emitPersistedObject(object $object, int $objectState)
Signalizes that the given object has been persisted
void
initialize(array $options)
Initializes the backend
void
setAggregateRootObjects(SplObjectStorage $objects)
Sets the aggregate root objects
void
setChangedEntities(SplObjectStorage $entities)
Sets the changed objects
void
setDeletedEntities(SplObjectStorage $entities)
Sets the deleted objects
void
commit()
Commits the current persistence session.
bool
isConnected()
Returns true, if an active connection to the persistence backend has been established, e.g. entities can be persisted.
protected void
persistObjects()
First persist new objects, then check reconstituted entities.
protected string
persistObject(object $object, string $parentIdentifier)
Stores or updates an object in the underlying storage.
abstract protected int
storeObject(object $object, string $identifier, string $parentIdentifier, array $objectData)
Actually store an object, backend-specific
protected void
processDeletedObjects()
Iterate over deleted entities and process them
abstract protected void
removeEntity(object $object)
Remove an entity
abstract protected void
removeValueObject(object $object)
Remove a value object
protected void
validateObject(object $object)
Validates the given object and throws an exception if validation fails.
protected string
getType(mixed $value)
Returns the type of $value, i.e. the class name or primitive type.
protected string
getTypeName(string $type)
Returns the type name as used in the database table names.
protected array
collectProperties(string $identifier, object $object, array $properties, bool $dirty)
No description
protected void
flattenValue(string $identifier, object $object, string $propertyName, array $propertyMetaData, array $propertyData)
Convert a value to the internal object data format
protected void
removeDeletedReference(object $object, string $propertyName, array $propertyMetaData)
Remove any unreferenced non aggregate root entity
protected array
processObject(object $object, string $parentIdentifier)
No description
protected mixed
checkPropertyValue(object $object, string $propertyName, array $propertyMetaData)
Check the property value for allowed types and throw exceptions for unsupported types.
protected array
processArray(array $array = null, string $parentIdentifier, array $previousArray = null)
Store an array as a set of records, with each array element becoming a property named like the key and the value.
Note: Objects contained in the array will have a matching entry created, the objects must be persisted elsewhere!
protected string
processNestedArray(string $parentIdentifier, array $nestedArray, Closure $handler = null)
"Serializes" a nested array for storage.
protected void
removeDeletedArrayEntries(array $array = null, array $previousArray)
Remove objects removed from array compared to $previousArray.
protected bool
arrayContainsObject(array $array, object $object, string $identifier)
Checks whether the given object is contained in the array. This checks for object identity in terms of the persistence layer, i.e. the UUID, when comparing entities.
protected array
processSplObjectStorage(SplObjectStorage $splObjectStorage = null, string $parentIdentifier, array $previousObjectStorage = null)
Store an SplObjectStorage as a set of records.
Note: Objects contained in the SplObjectStorage will have a matching entry created, the objects must be persisted elsewhere!
protected void
removeDeletedSplObjectStorageEntries(SplObjectStorage $splObjectStorage = null, array $previousObjectStorage)
Remove objects removed from SplObjectStorage compared to $previousSplObjectStorage.
protected int
processDateTime(DateTimeInterface $dateTime = null)
Creates a unix timestamp from the given DateTime object. If NULL is given NULL will be returned.