‪TYPO3CMS  10.4
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

Public Member Functions

 __construct (QueryFactoryInterface $queryFactory, BackendInterface $backend, Session $persistenceSession)
 
 registerRepositoryClassName ($className)
 
int getObjectCountByQuery (QueryInterface $query)
 
array getObjectDataByQuery (QueryInterface $query)
 
mixed getIdentifierByObject ($object)
 
object getObjectByIdentifier ($identifier, $objectType=null, $useLazyLoading=false)
 
 persistAll ()
 
QueryInterface createQueryForType ($type)
 
 add ($object)
 
 remove ($object)
 
 update ($object)
 
 injectSettings (array $settings)
 
 initializeObject ()
 
 clearState ()
 
bool isNewObject ($object)
 
 registerNewObject ($object)
 
 convertObjectToIdentityArray ($object)
 
 convertObjectsToIdentityArrays (array $array)
 
 tearDown ()
 

Protected Attributes

array $newObjects = array( )
 
ObjectStorage $changedObjects
 
ObjectStorage $addedObjects
 
ObjectStorage $removedObjects
 
TYPO3 CMS Extbase Persistence Generic QueryFactoryInterface $queryFactory
 
TYPO3 CMS Extbase Persistence Generic BackendInterface $backend
 
TYPO3 CMS Extbase Persistence Generic Session $persistenceSession
 

Detailed Description

The Extbase Persistence Manager

Definition at line 28 of file PersistenceManager.php.

Constructor & Destructor Documentation

◆ __construct()

TYPO3\CMS\Extbase\Persistence\Generic\PersistenceManager::__construct ( QueryFactoryInterface  $queryFactory,
BackendInterface  $backend,
Session  $persistenceSession 
)

Member Function Documentation

◆ add()

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

Adds an object to the persistence.

Parameters
object$object‪The object to add

Implements TYPO3\CMS\Extbase\Persistence\PersistenceManagerInterface.

Definition at line 184 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 247 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.

Parameters
object$object‪The object to be converted
Exceptions
Exception

Implements TYPO3\CMS\Extbase\Persistence\PersistenceManagerInterface.

Definition at line 291 of file PersistenceManager.php.

◆ createQueryForType()

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

Return a query object for the given type.

Parameters
string$type
Returns
QueryInterface

only to be used within Extbase, not part of TYPO3 Core API.

Implements TYPO3\CMS\Extbase\Persistence\PersistenceManagerInterface.

Definition at line 174 of file PersistenceManager.php.

◆ getIdentifierByObject()

mixed 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 122 of file PersistenceManager.php.

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

◆ getObjectByIdentifier()

object 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
bool$useLazyLoading‪Set 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 136 of file PersistenceManager.php.

◆ getObjectCountByQuery()

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

Returns the number of records matching the query.

Parameters
QueryInterface$query
Returns
‪int

Implements TYPO3\CMS\Extbase\Persistence\PersistenceManagerInterface.

Definition at line 95 of file PersistenceManager.php.

◆ getObjectDataByQuery()

array 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 106 of file PersistenceManager.php.

◆ initializeObject()

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

Initializes the persistence manager, called by Extbase.

only to be used within Extbase, not part of TYPO3 Core API.

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
Exceptions

Implements TYPO3\CMS\Extbase\Persistence\PersistenceManagerInterface.

Definition at line 224 of file PersistenceManager.php.

◆ isNewObject()

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

Checks if the given object has ever been persisted.

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

Implements TYPO3\CMS\Extbase\Persistence\PersistenceManagerInterface.

Definition at line 262 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.

Implements TYPO3\CMS\Extbase\Persistence\PersistenceManagerInterface.

Definition at line 151 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$object‪The new object to register

only to be used within Extbase, not part of TYPO3 Core API.

Definition at line 279 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$className‪The class name of the repository to be registered

only to be used within Extbase, not part of TYPO3 Core API.

Implements TYPO3\CMS\Extbase\Persistence\PersistenceManagerInterface.

Definition at line 85 of file PersistenceManager.php.

◆ remove()

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

Removes an object to the persistence.

Parameters
object$object‪The object to remove

Implements TYPO3\CMS\Extbase\Persistence\PersistenceManagerInterface.

Definition at line 195 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.

only to be used within Extbase, not part of TYPO3 Core API.

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$object‪The modified object
Exceptions

Implements TYPO3\CMS\Extbase\Persistence\PersistenceManagerInterface.

Definition at line 210 of file PersistenceManager.php.

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

Member Data Documentation

◆ $addedObjects

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

Definition at line 40 of file PersistenceManager.php.

◆ $backend

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

◆ $changedObjects

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

Definition at line 36 of file PersistenceManager.php.

◆ $newObjects

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

Definition at line 32 of file PersistenceManager.php.

◆ $persistenceSession

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

◆ $queryFactory

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

◆ $removedObjects

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

Definition at line 44 of file PersistenceManager.php.