TYPO3  7.6
Public Member Functions | Protected Attributes | List of all members
PersistenceManager Class Reference
Inheritance diagram for PersistenceManager:
PersistenceManagerInterface SingletonInterface

Public Member Functions

 injectQueryFactory (\TYPO3\CMS\Extbase\Persistence\Generic\QueryFactoryInterface $queryFactory)
 
 injectBackend (\TYPO3\CMS\Extbase\Persistence\Generic\BackendInterface $backend)
 
 injectPersistenceSession (\TYPO3\CMS\Extbase\Persistence\Generic\Session $persistenceSession)
 
 __construct ()
 
 registerRepositoryClassName ($className)
 
 getObjectCountByQuery (QueryInterface $query)
 
 getObjectDataByQuery (QueryInterface $query)
 
 getIdentifierByObject ($object)
 
 getObjectByIdentifier ($identifier, $objectType=null, $useLazyLoading=false)
 
 persistAll ()
 
 createQueryForType ($type)
 
 add ($object)
 
 remove ($object)
 
 update ($object)
 
 injectSettings (array $settings)
 
 initializeObject ()
 
 clearState ()
 
 isNewObject ($object)
 
 registerNewObject ($object)
 
 convertObjectToIdentityArray ($object)
 
 convertObjectsToIdentityArrays (array $array)
 
 tearDown ()
 

Protected Attributes

 $newObjects = array()
 
 $changedObjects
 
 $addedObjects
 
 $removedObjects
 
 $queryFactory
 
 $backend
 
 $persistenceSession
 

Detailed Description

The Extbase Persistence Manager

Definition at line 25 of file PersistenceManager.php.

Constructor & Destructor Documentation

__construct ( )

Create new instance

Definition at line 89 of file PersistenceManager.php.

Member Function Documentation

add (   $object)

Adds an object to the persistence.

Parameters
object$objectThe object to add
Returns
void

Implements PersistenceManagerInterface.

Definition at line 210 of file PersistenceManager.php.

clearState ( )

Clears the in-memory state of the persistence.

Managed instances become detached, any fetches will return data directly from the persistence "backend".

Exceptions
\TYPO3\CMS\Extbase\Persistence\Generic\Exception\NotImplementedException
Returns
void

Implements PersistenceManagerInterface.

Definition at line 280 of file PersistenceManager.php.

convertObjectsToIdentityArrays ( array  $array)

Recursively iterates through the given array and turns objects into arrays containing the identity of the domain object.

Exceptions
\TYPO3\CMS\Extbase\Persistence\Generic\Exception\NotImplementedException
Parameters
array$arrayThe array to be iterated over
Returns
array
See Also
convertObjectToIdentityArray()

Implements PersistenceManagerInterface.

Definition at line 342 of file PersistenceManager.php.

convertObjectToIdentityArray (   $object)

Converts the given object into an array containing the identity of the domain object.

Exceptions
\TYPO3\CMS\Extbase\Persistence\Generic\Exception\NotImplementedException
Parameters
object$objectThe object to be converted
Returns
array

Implements PersistenceManagerInterface.

Definition at line 327 of file PersistenceManager.php.

createQueryForType (   $type)

Return a query object for the given type.

Parameters
string$type
Returns
QueryInterface

Implements PersistenceManagerInterface.

Definition at line 198 of file PersistenceManager.php.

getIdentifierByObject (   $object)

Returns the (internal) identifier for the object, if it is known to the backend. Otherwise NULL is returned.

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.

Parameters
object$object
Returns
mixed The identifier for the object if it is known, or NULL

Implements PersistenceManagerInterface.

Definition at line 142 of file PersistenceManager.php.

Referenced by PersistenceManager\registerNewObject().

getObjectByIdentifier (   $identifier,
  $objectType = null,
  $useLazyLoading = false 
)

Returns the object with the (internal) identifier, if it is known to the backend. Otherwise NULL is returned.

Parameters
mixed$identifier
string$objectType
bool$useLazyLoadingSet to TRUE if you want to use lazy loading for this object
Returns
object The object for the identifier if it is known, or NULL

Implements PersistenceManagerInterface.

Definition at line 157 of file PersistenceManager.php.

getObjectCountByQuery ( QueryInterface  $query)

Returns the number of records matching the query.

Parameters
QueryInterface$query
Returns
int

Implements PersistenceManagerInterface.

Definition at line 113 of file PersistenceManager.php.

getObjectDataByQuery ( QueryInterface  $query)

Returns the object data matching the $query.

Parameters
QueryInterface$query
Returns
array

Implements PersistenceManagerInterface.

Definition at line 125 of file PersistenceManager.php.

initializeObject ( )

Initializes the persistence manager, called by Extbase.

Returns
void

Definition at line 266 of file PersistenceManager.php.

Parameters
\TYPO3\CMS\Extbase\Persistence\Generic\BackendInterface$backend

Definition at line 73 of file PersistenceManager.php.

References PersistenceManager\$backend.

injectPersistenceSession ( \TYPO3\CMS\Extbase\Persistence\Generic\Session  $persistenceSession)
Parameters
\TYPO3\CMS\Extbase\Persistence\Generic\Session$persistenceSession

Definition at line 81 of file PersistenceManager.php.

References PersistenceManager\$persistenceSession.

injectQueryFactory ( \TYPO3\CMS\Extbase\Persistence\Generic\QueryFactoryInterface  $queryFactory)
Parameters
\TYPO3\CMS\Extbase\Persistence\Generic\QueryFactoryInterface$queryFactory

Definition at line 65 of file PersistenceManager.php.

References PersistenceManager\$queryFactory.

injectSettings ( array  $settings)

Injects the Extbase settings, called by Extbase.

Parameters
array$settings
Returns
void
Exceptions
\TYPO3\CMS\Extbase\Persistence\Generic\Exception\NotImplementedException

Implements PersistenceManagerInterface.

Definition at line 256 of file PersistenceManager.php.

isNewObject (   $object)

Checks if the given object has ever been persisted.

Parameters
object$objectThe object to check
Returns
bool TRUE if the object is new, FALSE if the object exists in the persistence session

Implements PersistenceManagerInterface.

Definition at line 296 of file PersistenceManager.php.

Referenced by PersistenceManager\update().

persistAll ( )

Commits new objects and changes to objects in the current persistence session into the backend

Returns
void

Implements PersistenceManagerInterface.

Definition at line 176 of file PersistenceManager.php.

registerNewObject (   $object)

Registers an object which has been created or cloned during this request.

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.

Parameters
object$objectThe new object to register
Returns
void

Definition at line 313 of file PersistenceManager.php.

References PersistenceManager\getIdentifierByObject().

registerRepositoryClassName (   $className)

Registers a repository

Parameters
string$classNameThe class name of the repository to be registered
Returns
void

Implements PersistenceManagerInterface.

Definition at line 102 of file PersistenceManager.php.

remove (   $object)

Removes an object to the persistence.

Parameters
object$objectThe object to remove
Returns
void

Implements PersistenceManagerInterface.

Definition at line 223 of file PersistenceManager.php.

tearDown ( )

Tear down the persistence

This method is called in functional tests to reset the storage between tests. The implementation is optional and depends on the underlying persistence backend.

Returns
void

Definition at line 355 of file PersistenceManager.php.

update (   $object)

Update an object in the persistence.

Parameters
object$objectThe modified object
Returns
void
Exceptions
\TYPO3\CMS\Extbase\Persistence\Exception\UnknownObjectException

Implements PersistenceManagerInterface.

Definition at line 240 of file PersistenceManager.php.

References PersistenceManager\isNewObject().

Member Data Documentation

$addedObjects
protected

Definition at line 40 of file PersistenceManager.php.

$backend
protected

Definition at line 55 of file PersistenceManager.php.

Referenced by PersistenceManager\injectBackend().

$changedObjects
protected

Definition at line 35 of file PersistenceManager.php.

$newObjects = array()
protected

Definition at line 30 of file PersistenceManager.php.

$persistenceSession
protected

Definition at line 60 of file PersistenceManager.php.

Referenced by PersistenceManager\injectPersistenceSession().

$queryFactory
protected

Definition at line 50 of file PersistenceManager.php.

Referenced by PersistenceManager\injectQueryFactory().

$removedObjects
protected

Definition at line 45 of file PersistenceManager.php.