PHP Class Neos\Flow\Persistence\Generic\Session

Show file Open project: neos/flow-development-collection Class Usage Examples

Protected Properties

Property Type Description
$identifierMap array
$objectMap SplObjectStorage
$reconstitutedEntities SplObjectStorage Reconstituted objects
$reconstitutedEntitiesData array Reconstituted entity data (effectively their clean state)
$reflectionService Neos\Flow\Reflection\ReflectionService

Public Methods

Method Description
__construct ( ) Constructs a new Session
destroy ( ) : void Destroy the state of the persistence session and reset all internal data.
getCleanStateOfProperty ( object $object, string $propertyName ) : mixed Returns the previous (last persisted) state of the property.
getIdentifierByObject ( object $object ) : string 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.
getObjectByIdentifier ( string $identifier ) : object Returns the object for the given identifier
getReconstitutedEntities ( ) : SplObjectStorage Returns all objects which have been registered as reconstituted
hasIdentifier ( string $identifier ) : boolean Checks whether the given identifier is known to the identity map
hasObject ( object $object ) : boolean Checks whether the given object is known to the identity map
injectReflectionService ( ReflectionService $reflectionService ) : void Injects a Reflection Service instance
isDirty ( object $object, string $propertyName ) : boolean Checks whether the given property was changed in the object since it was reconstituted. Returns TRUE for unknown objects in all cases!
isReconstitutedEntity ( object $entity ) : boolean Tells whether the given object is a reconstituted entity.
registerObject ( object $object, string $identifier ) Register an identifier for an object
registerReconstitutedEntity ( object $entity, array $entityData ) : void Registers data for a reconstituted object.
replaceReconstitutedEntity ( object $oldEntity, object $newEntity ) : void Replace a reconstituted object, leaves the clean data unchanged.
unregisterObject ( string $object ) : void Unregister an object
unregisterReconstitutedEntity ( object $entity ) : void Unregisters data for a reconstituted object

Protected Methods

Method Description
isMultiValuedPropertyDirty ( array $cleanData, Traversable $currentValue ) : boolean Checks the $currentValue against the $cleanData.
isSingleValuedPropertyDirty ( string $type, mixed $previousValue, $currentValue ) : boolean Checks the $previousValue against the $currentValue.

Method Details

__construct() public method

Constructs a new Session
public __construct ( )

destroy() public method

Destroy the state of the persistence session and reset all internal data.
public destroy ( ) : void
return void

getCleanStateOfProperty() public method

If nothing is found, NULL is returned.
public getCleanStateOfProperty ( object $object, string $propertyName ) : mixed
$object object
$propertyName string
return mixed

getIdentifierByObject() public method

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.
public getIdentifierByObject ( object $object ) : string
$object object
return string

getObjectByIdentifier() public method

Returns the object for the given identifier
public getObjectByIdentifier ( string $identifier ) : object
$identifier string
return object

getReconstitutedEntities() public method

Returns all objects which have been registered as reconstituted
public getReconstitutedEntities ( ) : SplObjectStorage
return SplObjectStorage All reconstituted objects

hasIdentifier() public method

Checks whether the given identifier is known to the identity map
public hasIdentifier ( string $identifier ) : boolean
$identifier string
return boolean

hasObject() public method

Checks whether the given object is known to the identity map
public hasObject ( object $object ) : boolean
$object object
return boolean

injectReflectionService() public method

Injects a Reflection Service instance
public injectReflectionService ( ReflectionService $reflectionService ) : void
$reflectionService Neos\Flow\Reflection\ReflectionService
return void

isDirty() public method

Checks whether the given property was changed in the object since it was reconstituted. Returns TRUE for unknown objects in all cases!
public isDirty ( object $object, string $propertyName ) : boolean
$object object
$propertyName string
return boolean

isMultiValuedPropertyDirty() protected method

Checks the $currentValue against the $cleanData.
protected isMultiValuedPropertyDirty ( array $cleanData, Traversable $currentValue ) : boolean
$cleanData array
$currentValue Traversable
return boolean

isReconstitutedEntity() public method

Tells whether the given object is a reconstituted entity.
public isReconstitutedEntity ( object $entity ) : boolean
$entity object
return boolean

isSingleValuedPropertyDirty() protected method

Checks the $previousValue against the $currentValue.
protected isSingleValuedPropertyDirty ( string $type, mixed $previousValue, $currentValue ) : boolean
$type string
$previousValue mixed
return boolean

registerObject() public method

Register an identifier for an object
public registerObject ( object $object, string $identifier )
$object object
$identifier string

registerReconstitutedEntity() public method

$entityData format is described in "Documentation/PersistenceFramework object data format.txt"
public registerReconstitutedEntity ( object $entity, array $entityData ) : void
$entity object
$entityData array
return void

replaceReconstitutedEntity() public method

Replace a reconstituted object, leaves the clean data unchanged.
public replaceReconstitutedEntity ( object $oldEntity, object $newEntity ) : void
$oldEntity object
$newEntity object
return void

unregisterObject() public method

Unregister an object
public unregisterObject ( string $object ) : void
$object string
return void

unregisterReconstitutedEntity() public method

Unregisters data for a reconstituted object
public unregisterReconstitutedEntity ( object $entity ) : void
$entity object
return void

Property Details

$identifierMap protected property

protected array $identifierMap
return array

$objectMap protected property

protected SplObjectStorage $objectMap
return SplObjectStorage

$reconstitutedEntities protected property

Reconstituted objects
protected SplObjectStorage $reconstitutedEntities
return SplObjectStorage

$reconstitutedEntitiesData protected property

Reconstituted entity data (effectively their clean state)
protected array $reconstitutedEntitiesData
return array

$reflectionService protected property

protected ReflectionService,Neos\Flow\Reflection $reflectionService
return Neos\Flow\Reflection\ReflectionService