TYPO3 CMS  TYPO3_6-2
TYPO3\CMS\Extbase\Persistence\Generic\PersistenceManager Class Reference
Inheritance diagram for TYPO3\CMS\Extbase\Persistence\Generic\PersistenceManager:
TYPO3\CMS\Extbase\Persistence\PersistenceManagerInterface TYPO3\CMS\Core\SingletonInterface Tx_Extbase_Persistence_Manager

Public Member Functions

 __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 24 of file PersistenceManager.php.

Constructor & Destructor Documentation

◆ __construct()

TYPO3\CMS\Extbase\Persistence\Generic\PersistenceManager::__construct ( )

Create new instance

Definition at line 67 of file PersistenceManager.php.

Member Function Documentation

◆ add()

TYPO3\CMS\Extbase\Persistence\Generic\PersistenceManager::add (   $object)

Adds an object to the persistence.

Parameters
object$objectThe object to add
Returns
void

Implements TYPO3\CMS\Extbase\Persistence\PersistenceManagerInterface.

Definition at line 181 of file PersistenceManager.php.

◆ clearState()

TYPO3\CMS\Extbase\Persistence\Generic\PersistenceManager::clearState ( )

Clears the in-memory state of the persistence.

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

Exceptions

Implements TYPO3\CMS\Extbase\Persistence\PersistenceManagerInterface.

Definition at line 246 of file PersistenceManager.php.

◆ convertObjectsToIdentityArrays()

TYPO3\CMS\Extbase\Persistence\Generic\PersistenceManager::convertObjectsToIdentityArrays ( array  $array)

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

Exceptions

Implements TYPO3\CMS\Extbase\Persistence\PersistenceManagerInterface.

Definition at line 304 of file PersistenceManager.php.

◆ convertObjectToIdentityArray()

TYPO3\CMS\Extbase\Persistence\Generic\PersistenceManager::convertObjectToIdentityArray (   $object)

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

Exceptions

Implements TYPO3\CMS\Extbase\Persistence\PersistenceManagerInterface.

Definition at line 290 of file PersistenceManager.php.

◆ createQueryForType()

TYPO3\CMS\Extbase\Persistence\Generic\PersistenceManager::createQueryForType (   $type)

Return a query object for the given type.

Parameters
string$type
Returns
QueryInterface

Implements TYPO3\CMS\Extbase\Persistence\PersistenceManagerInterface.

Definition at line 170 of file PersistenceManager.php.

◆ getIdentifierByObject()

TYPO3\CMS\Extbase\Persistence\Generic\PersistenceManager::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 TYPO3\CMS\Extbase\Persistence\PersistenceManagerInterface.

Definition at line 117 of file PersistenceManager.php.

Referenced by TYPO3\CMS\Extbase\Persistence\Generic\PersistenceManager\registerNewObject().

◆ getObjectByIdentifier()

TYPO3\CMS\Extbase\Persistence\Generic\PersistenceManager::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
boolean$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 TYPO3\CMS\Extbase\Persistence\PersistenceManagerInterface.

Definition at line 131 of file PersistenceManager.php.

◆ getObjectCountByQuery()

TYPO3\CMS\Extbase\Persistence\Generic\PersistenceManager::getObjectCountByQuery ( QueryInterface  $query)

Returns the number of records matching the query.

Parameters
QueryInterface$query
Returns
integer

Implements TYPO3\CMS\Extbase\Persistence\PersistenceManagerInterface.

Definition at line 90 of file PersistenceManager.php.

◆ getObjectDataByQuery()

TYPO3\CMS\Extbase\Persistence\Generic\PersistenceManager::getObjectDataByQuery ( QueryInterface  $query)

Returns the object data matching the $query.

Parameters
QueryInterface$query
Returns
array

Implements TYPO3\CMS\Extbase\Persistence\PersistenceManagerInterface.

Definition at line 101 of file PersistenceManager.php.

◆ initializeObject()

TYPO3\CMS\Extbase\Persistence\Generic\PersistenceManager::initializeObject ( )

Initializes the persistence manager, called by Extbase.

Returns
void

Definition at line 233 of file PersistenceManager.php.

◆ injectSettings()

TYPO3\CMS\Extbase\Persistence\Generic\PersistenceManager::injectSettings ( array  $settings)

Injects the Extbase settings, called by Extbase.

Parameters
array$settings
Returns
void
Exceptions

Implements TYPO3\CMS\Extbase\Persistence\PersistenceManagerInterface.

Definition at line 224 of file PersistenceManager.php.

◆ isNewObject()

TYPO3\CMS\Extbase\Persistence\Generic\PersistenceManager::isNewObject (   $object)

Checks if the given object has ever been persisted.

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

Implements TYPO3\CMS\Extbase\Persistence\PersistenceManagerInterface.

Definition at line 261 of file PersistenceManager.php.

Referenced by TYPO3\CMS\Extbase\Persistence\Generic\PersistenceManager\update().

◆ persistAll()

TYPO3\CMS\Extbase\Persistence\Generic\PersistenceManager::persistAll ( )

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

Returns
void

Implements TYPO3\CMS\Extbase\Persistence\PersistenceManagerInterface.

Definition at line 149 of file PersistenceManager.php.

◆ registerNewObject()

TYPO3\CMS\Extbase\Persistence\Generic\PersistenceManager::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 277 of file PersistenceManager.php.

References TYPO3\CMS\Extbase\Persistence\Generic\PersistenceManager\getIdentifierByObject().

◆ registerRepositoryClassName()

TYPO3\CMS\Extbase\Persistence\Generic\PersistenceManager::registerRepositoryClassName (   $className)

Registers a repository

Parameters
string$classNameThe class name of the repository to be reigistered
Deprecated:
since 6.1, will be remove two versions later
Returns
void

Implements TYPO3\CMS\Extbase\Persistence\PersistenceManagerInterface.

Definition at line 80 of file PersistenceManager.php.

◆ remove()

TYPO3\CMS\Extbase\Persistence\Generic\PersistenceManager::remove (   $object)

Removes an object to the persistence.

Parameters
object$objectThe object to remove
Returns
void

Implements TYPO3\CMS\Extbase\Persistence\PersistenceManagerInterface.

Definition at line 193 of file PersistenceManager.php.

◆ tearDown()

TYPO3\CMS\Extbase\Persistence\Generic\PersistenceManager::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 316 of file PersistenceManager.php.

◆ update()

TYPO3\CMS\Extbase\Persistence\Generic\PersistenceManager::update (   $object)

Update an object in the persistence.

Parameters
object$objectThe modified object
Returns
void
Exceptions

Implements TYPO3\CMS\Extbase\Persistence\PersistenceManagerInterface.

Definition at line 209 of file PersistenceManager.php.

References TYPO3\CMS\Extbase\Persistence\Generic\PersistenceManager\isNewObject().

Member Data Documentation

◆ $addedObjects

TYPO3\CMS\Extbase\Persistence\Generic\PersistenceManager::$addedObjects
protected

Definition at line 39 of file PersistenceManager.php.

◆ $backend

TYPO3\CMS\Extbase\Persistence\Generic\PersistenceManager::$backend
protected

Definition at line 56 of file PersistenceManager.php.

◆ $changedObjects

TYPO3\CMS\Extbase\Persistence\Generic\PersistenceManager::$changedObjects
protected

Definition at line 34 of file PersistenceManager.php.

◆ $newObjects

TYPO3\CMS\Extbase\Persistence\Generic\PersistenceManager::$newObjects = array()
protected

Definition at line 29 of file PersistenceManager.php.

◆ $persistenceSession

TYPO3\CMS\Extbase\Persistence\Generic\PersistenceManager::$persistenceSession
protected

Definition at line 62 of file PersistenceManager.php.

◆ $queryFactory

TYPO3\CMS\Extbase\Persistence\Generic\PersistenceManager::$queryFactory
protected

Definition at line 50 of file PersistenceManager.php.

◆ $removedObjects

TYPO3\CMS\Extbase\Persistence\Generic\PersistenceManager::$removedObjects
protected

Definition at line 44 of file PersistenceManager.php.