PHP Class Neos\Flow\Persistence\Generic\PersistenceManager

Inheritance: extends Neos\Flow\Persistence\AbstractPersistenceManager
ファイルを表示 Open project: neos/flow-development-collection Class Usage Examples

Protected Properties

Property Type Description
$addedObjects SplObjectStorage
$backend Neos\Flow\Persistence\Generic\Backend\BackendInterface
$changedObjects SplObjectStorage
$dataMapper DataMapper
$persistenceSession Session
$queryFactory Neos\Flow\Persistence\Generic\QueryFactoryInterface
$removedObjects SplObjectStorage

Public Methods

Method Description
__construct ( ) Create new instance
add ( object $object ) : void Adds an object to the persistence.
clearState ( ) : void Clears the in-memory state of the persistence.
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.
getObjectCountByQuery ( Neos\Flow\Persistence\QueryInterface $query ) : integer Returns the number of records matching the query.
getObjectDataByIdentifier ( string $identifier, string $objectType = null ) : object Returns the object data for the (internal) identifier, if it is known to the backend. Otherwise FALSE is returned.
getObjectDataByQuery ( Neos\Flow\Persistence\QueryInterface $query ) : array Returns the object data matching the $query.
initialize ( ) : void Initializes the persistence manager
injectBackend ( Neos\Flow\Persistence\Generic\Backend\BackendInterface $backend ) : void Injects the backend to use
injectDataMapper ( DataMapper $dataMapper ) : void Injects the data mapper
injectPersistenceSession ( Session $persistenceSession ) : void Injects the persistence session
injectQueryFactory ( Neos\Flow\Persistence\Generic\QueryFactoryInterface $queryFactory ) : void Injects a QueryFactory instance
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
remove ( object $object ) : void Removes an object to the persistence.
tearDown ( ) : void Tear down the persistence
update ( object $object ) : void Update an object in the persistence.

Protected Methods

Method Description
emitAllObjectsPersisted ( ) : void Signals that all persistAll() has been executed successfully.

Method Details

__construct() public method

Create new instance
public __construct ( )

add() public method

Adds an object to the persistence.
public add ( object $object ) : void
$object object The object to add
return void

clearState() public method

Managed instances become detached, any fetches will return data directly from the persistence "backend". It will also forget about new objects.
public clearState ( ) : void
return void

createQueryForType() public method

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

emitAllObjectsPersisted() protected method

Signals that all persistAll() has been executed successfully.
protected emitAllObjectsPersisted ( ) : void
return void

getIdentifierByObject() public method

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
return mixed The identifier for the object if it is known, or NULL

getObjectByIdentifier() public method

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 This option is ignored in this persistence manager
return object The object for the identifier if it is known, or NULL

getObjectCountByQuery() public method

Returns the number of records matching the query.
public getObjectCountByQuery ( Neos\Flow\Persistence\QueryInterface $query ) : integer
$query Neos\Flow\Persistence\QueryInterface
return integer

getObjectDataByIdentifier() public method

Returns the object data for the (internal) identifier, if it is known to the backend. Otherwise FALSE is returned.
public getObjectDataByIdentifier ( string $identifier, string $objectType = null ) : object
$identifier string
$objectType string
return object The object data for the identifier if it is known, or FALSE

getObjectDataByQuery() public method

Returns the object data matching the $query.
public getObjectDataByQuery ( Neos\Flow\Persistence\QueryInterface $query ) : array
$query Neos\Flow\Persistence\QueryInterface
return array

initialize() public method

Initializes the persistence manager
public initialize ( ) : void
return void

injectBackend() public method

Injects the backend to use
public injectBackend ( Neos\Flow\Persistence\Generic\Backend\BackendInterface $backend ) : void
$backend Neos\Flow\Persistence\Generic\Backend\BackendInterface the backend to use for persistence
return void

injectDataMapper() public method

Injects the data mapper
public injectDataMapper ( DataMapper $dataMapper ) : void
$dataMapper DataMapper
return void

injectPersistenceSession() public method

Injects the persistence session
public injectPersistenceSession ( Session $persistenceSession ) : void
$persistenceSession Session The persistence session
return void

injectQueryFactory() public method

Injects a QueryFactory instance
public injectQueryFactory ( Neos\Flow\Persistence\Generic\QueryFactoryInterface $queryFactory ) : void
$queryFactory Neos\Flow\Persistence\Generic\QueryFactoryInterface
return void

isConnected() public method

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

isNewObject() public method

Checks if the given object has ever been persisted.
public isNewObject ( object $object ) : boolean
$object object The object to check
return boolean TRUE if the object is new, FALSE if the object exists in the persistence session

persistAll() public method

Commits new objects and changes to objects in the current persistence session into the backend
public persistAll ( boolean $onlyWhitelistedObjects = false ) : void
$onlyWhitelistedObjects boolean
return void

remove() public method

Removes an object to the persistence.
public remove ( object $object ) : void
$object object The object to remove
return void

tearDown() public method

This method is called in functional tests to reset the storage between tests. The implementation is optional and depends on the underlying persistence backend.
public tearDown ( ) : void
return void

update() public method

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

Property Details

$addedObjects protected_oe property

protected SplObjectStorage $addedObjects
return SplObjectStorage

$backend protected_oe property

protected BackendInterface,Neos\Flow\Persistence\Generic\Backend $backend
return Neos\Flow\Persistence\Generic\Backend\BackendInterface

$changedObjects protected_oe property

protected SplObjectStorage $changedObjects
return SplObjectStorage

$dataMapper protected_oe property

protected DataMapper,Neos\Flow\Persistence\Generic $dataMapper
return DataMapper

$persistenceSession protected_oe property

protected Session,Neos\Flow\Persistence\Generic $persistenceSession
return Session

$queryFactory protected_oe property

protected QueryFactoryInterface,Neos\Flow\Persistence\Generic $queryFactory
return Neos\Flow\Persistence\Generic\QueryFactoryInterface

$removedObjects protected_oe property

protected SplObjectStorage $removedObjects
return SplObjectStorage