PHP Interface Neos\Flow\Persistence\PersistenceManagerInterface

Afficher le fichier Open project: neos/flow-development-collection Interface Usage Examples

Méthodes publiques

Méthode Description
add ( object $object ) : void Adds an object to the persistence.
clearState ( ) : void Clears the in-memory state of the persistence.
convertObjectToIdentityArray ( object $object ) : array Converts the given object into an array containing the identity of the domain object.
convertObjectsToIdentityArrays ( array $array ) : array Recursively iterates through the given array and turns objects into arrays containing the identity of the domain object.
createQueryForType ( string $type ) : Neos\Flow\Persistence\QueryInterface Return a query object for the given type.
getIdentifierByObject ( object $object ) : mixed Returns the (internal) identifier for the object, if it is known to the backend. Otherwise NULL is returned.
getObjectByIdentifier ( mixed $identifier, string $objectType = null, boolean $useLazyLoading = false ) : object Returns the object with the (internal) identifier, if it is known to the backend. Otherwise NULL is returned.
hasUnpersistedChanges ( ) : boolean Gives feedback if the persistence Manager has unpersisted changes.
injectSettings ( array $settings ) : void Injects the Flow settings, called by Flow.
isConnected ( ) : boolean Returns TRUE, if an active connection to the persistence backend has been established, e.g. entities can be persisted.
isNewObject ( object $object ) : boolean Checks if the given object has ever been persisted.
persistAll ( boolean $onlyWhitelistedObjects = false ) : void Commits new objects and changes to objects in the current persistence session into the backend.
registerNewObject ( Aspect\PersistenceMagicInterface $object ) : void Registers an object which has been created or cloned during this request.
remove ( object $object ) : void Removes an object to the persistence.
update ( object $object ) : void Update an object in the persistence.
whitelistObject ( object $object ) : void Adds the given object to a whitelist of objects which may be persisted when persistAll() is called with the $onlyWhitelistedObjects flag. This is the case if "safe" HTTP request methods are used.

Method Details

add() public méthode

Adds an object to the persistence.
public add ( object $object ) : void
$object object The object to add
Résultat void

clearState() public méthode

Managed instances become detached, any fetches will return data directly from the persistence "backend".
public clearState ( ) : void
Résultat void

convertObjectToIdentityArray() public méthode

Converts the given object into an array containing the identity of the domain object.
public convertObjectToIdentityArray ( object $object ) : array
$object object The object to be converted
Résultat array The identity array in the format array('__identity' => '...')

convertObjectsToIdentityArrays() public méthode

Recursively iterates through the given array and turns objects into arrays containing the identity of the domain object.
See also: convertObjectToIdentityArray()
public convertObjectsToIdentityArrays ( array $array ) : array
$array array The array to be iterated over
Résultat array The modified array without objects

createQueryForType() public méthode

Return a query object for the given type.
public createQueryForType ( string $type ) : Neos\Flow\Persistence\QueryInterface
$type string
Résultat Neos\Flow\Persistence\QueryInterface

getIdentifierByObject() public méthode

Note: this returns an identifier 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 ) : mixed
$object object
Résultat mixed The identifier for the object if it is known, or NULL

getObjectByIdentifier() public méthode

Returns the object with the (internal) identifier, if it is known to the backend. Otherwise NULL is returned.
public getObjectByIdentifier ( mixed $identifier, string $objectType = null, boolean $useLazyLoading = false ) : object
$identifier mixed
$objectType string
$useLazyLoading boolean Set to TRUE if you want to use lazy loading for this object
Résultat object The object for the identifier if it is known, or NULL

hasUnpersistedChanges() public méthode

This is primarily used to inform the user if he tries to save data in an unsafe request.
public hasUnpersistedChanges ( ) : boolean
Résultat boolean

injectSettings() public méthode

Injects the Flow settings, called by Flow.
public injectSettings ( array $settings ) : void
$settings array
Résultat void

isConnected() public méthode

Returns TRUE, if an active connection to the persistence backend has been established, e.g. entities can be persisted.
public isConnected ( ) : boolean
Résultat boolean TRUE, if an connection has been established, FALSE if add object will not be persisted by the backend

isNewObject() public méthode

Checks if the given object has ever been persisted.
public isNewObject ( object $object ) : boolean
$object object The object to check
Résultat boolean TRUE if the object is new, FALSE if the object exists in the repository

persistAll() public méthode

If $onlyWhitelisteObjects is set to TRUE, only those objects which have been registered with whitelistObject() will be persisted. If other objects are in the queue, an exception will be raised.
public persistAll ( boolean $onlyWhitelistedObjects = false ) : void
$onlyWhitelistedObjects boolean
Résultat void

registerNewObject() public méthode

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.
public registerNewObject ( Aspect\PersistenceMagicInterface $object ) : void
$object Aspect\PersistenceMagicInterface The new object to register
Résultat void

remove() public méthode

Removes an object to the persistence.
public remove ( object $object ) : void
$object object The object to remove
Résultat void

update() public méthode

Update an object in the persistence.
public update ( object $object ) : void
$object object The modified object
Résultat void

whitelistObject() public méthode

Adds the given object to a whitelist of objects which may be persisted when persistAll() is called with the $onlyWhitelistedObjects flag. This is the case if "safe" HTTP request methods are used.
public whitelistObject ( object $object ) : void
$object object The object
Résultat void