PHP Интерфейс Neos\Flow\Persistence\PersistenceManagerInterface

Показать файл Открыть проект Примеры использования интерфейса

Открытые методы

Метод Описание
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.

Описание методов

add() публичный Метод

Adds an object to the persistence.
public add ( object $object ) : void
$object object The object to add
Результат void

clearState() публичный Метод

Managed instances become detached, any fetches will return data directly from the persistence "backend".
public clearState ( ) : void
Результат void

convertObjectToIdentityArray() публичный Метод

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
Результат array The identity array in the format array('__identity' => '...')

convertObjectsToIdentityArrays() публичный Метод

Recursively iterates through the given array and turns objects into arrays containing the identity of the domain object.
См. также: convertObjectToIdentityArray()
public convertObjectsToIdentityArrays ( array $array ) : array
$array array The array to be iterated over
Результат array The modified array without objects

createQueryForType() публичный Метод

Return a query object for the given type.
public createQueryForType ( string $type ) : Neos\Flow\Persistence\QueryInterface
$type string
Результат Neos\Flow\Persistence\QueryInterface

getIdentifierByObject() публичный Метод

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
Результат mixed The identifier for the object if it is known, or NULL

getObjectByIdentifier() публичный Метод

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
Результат object The object for the identifier if it is known, or NULL

hasUnpersistedChanges() публичный Метод

This is primarily used to inform the user if he tries to save data in an unsafe request.
public hasUnpersistedChanges ( ) : boolean
Результат boolean

injectSettings() публичный Метод

Injects the Flow settings, called by Flow.
public injectSettings ( array $settings ) : void
$settings array
Результат void

isConnected() публичный Метод

Returns TRUE, if an active connection to the persistence backend has been established, e.g. entities can be persisted.
public isConnected ( ) : boolean
Результат boolean TRUE, if an connection has been established, FALSE if add object will not be persisted by the backend

isNewObject() публичный Метод

Checks if the given object has ever been persisted.
public isNewObject ( object $object ) : boolean
$object object The object to check
Результат boolean TRUE if the object is new, FALSE if the object exists in the repository

persistAll() публичный Метод

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
Результат void

registerNewObject() публичный Метод

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
Результат void

remove() публичный Метод

Removes an object to the persistence.
public remove ( object $object ) : void
$object object The object to remove
Результат void

update() публичный Метод

Update an object in the persistence.
public update ( object $object ) : void
$object object The modified object
Результат void

whitelistObject() публичный Метод

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
Результат void