Session deprecated
class Session (View source)
deprecated
The persistence session - acts as a UoW and Identity Map for Flow's persistence framework.
Properties
protected SplObjectStorage | $reconstitutedEntities | Reconstituted objects |
|
protected array | $reconstitutedEntitiesData | Reconstituted entity data (effectively their clean state) |
|
protected SplObjectStorage | $objectMap | ||
protected array | $identifierMap | ||
protected ReflectionService | $reflectionService |
Methods
Constructs a new Session
Registers data for a reconstituted object.
Replace a reconstituted object, leaves the clean data unchanged.
Unregisters data for a reconstituted object
Returns all objects which have been registered as reconstituted
Tells whether the given object is a reconstituted entity.
Checks whether the given property was changed in the object since it was reconstituted. Returns true for unknown objects in all cases!
Checks the $currentValue against the $cleanData.
Checks the $previousValue against the $currentValue.
Returns the previous (last persisted) state of the property.
Checks whether the given object is known to the identity map
Checks whether the given identifier is known to the identity map
Returns the object for the given identifier
Returns the identifier for the given object either from the session, if the object was registered, or from the object itself using a special uuid property or the internal properties set by AOP.
Register an identifier for an object
Unregister an object
Destroy the state of the persistence session and reset all internal data.
Details
__construct()
Constructs a new Session
void
injectReflectionService(ReflectionService $reflectionService)
Injects a Reflection Service instance
void
registerReconstitutedEntity(object $entity, array $entityData)
Registers data for a reconstituted object.
$entityData format is described in "Documentation/PersistenceFramework object data format.txt"
void
replaceReconstitutedEntity(object $oldEntity, object $newEntity)
Replace a reconstituted object, leaves the clean data unchanged.
void
unregisterReconstitutedEntity(object $entity)
Unregisters data for a reconstituted object
SplObjectStorage
getReconstitutedEntities()
Returns all objects which have been registered as reconstituted
bool
isReconstitutedEntity(object $entity)
Tells whether the given object is a reconstituted entity.
bool
isDirty(object $object, string $propertyName)
Checks whether the given property was changed in the object since it was reconstituted. Returns true for unknown objects in all cases!
protected bool
isMultiValuedPropertyDirty(array $cleanData, Traversable $currentValue)
Checks the $currentValue against the $cleanData.
protected bool
isSingleValuedPropertyDirty(string $type, mixed $previousValue, mixed $currentValue)
Checks the $previousValue against the $currentValue.
mixed
getCleanStateOfProperty(object $object, string $propertyName)
Returns the previous (last persisted) state of the property.
If nothing is found, NULL is returned.
bool
hasObject(object $object)
Checks whether the given object is known to the identity map
bool
hasIdentifier(string $identifier)
Checks whether the given identifier is known to the identity map
object
getObjectByIdentifier(string $identifier)
Returns the object for the given identifier
string
getIdentifierByObject(object $object)
Returns the identifier for the given object either from the session, if the object was registered, or from the object itself using a special uuid property or the internal properties set by AOP.
Note: this returns an UUID even if the object has not been persisted in case of AOP-managed entities. Use isNewObject() if you need to distinguish those cases.
registerObject(object $object, string $identifier)
Register an identifier for an object
void
unregisterObject(string $object)
Unregister an object
void
destroy()
Destroy the state of the persistence session and reset all internal data.