‪TYPO3CMS  10.4
TYPO3\CMS\Extbase\Persistence\Repository Class Reference
Inheritance diagram for TYPO3\CMS\Extbase\Persistence\Repository:
TYPO3\CMS\Extbase\Persistence\RepositoryInterface TYPO3\CMS\Core\SingletonInterface ExtbaseTeam\A\Domain\Model\ARepository ExtbaseTeam\B\Domain\Model\BRepository ExtbaseTeam\BlogExample\Domain\Repository\BlogRepository ExtbaseTeam\BlogExample\Domain\Repository\PersonRepository ExtbaseTeam\BlogExample\Domain\Repository\PostRepository ExtbaseTeam\BlogExample\Domain\Repository\TtContentRepository OliverHader\IrreTutorial\Domain\Repository\ContentRepository TYPO3\CMS\Belog\Domain\Repository\LogEntryRepository TYPO3\CMS\Belog\Domain\Repository\WorkspaceRepository TYPO3\CMS\Beuser\Domain\Repository\BackendUserGroupRepository TYPO3\CMS\Beuser\Domain\Repository\BackendUserSessionRepository TYPO3\CMS\Extbase\Domain\Repository\BackendUserGroupRepository TYPO3\CMS\Extbase\Domain\Repository\BackendUserRepository TYPO3\CMS\Extbase\Domain\Repository\CategoryRepository TYPO3\CMS\Extbase\Domain\Repository\FileMountRepository TYPO3\CMS\Extbase\Domain\Repository\FrontendUserGroupRepository TYPO3\CMS\Extbase\Domain\Repository\FrontendUserRepository TYPO3\CMS\Extbase\Tests\Unit\Persistence\Fixture\Domain\Repository\EntityRepository TYPO3\CMS\Extbase\Tests\Unit\Reflection\Fixture\DummyModelRepository TYPO3\CMS\Extensionmanager\Domain\Repository\ExtensionRepository TYPO3\CMS\Extensionmanager\Domain\Repository\RepositoryRepository

Public Member Functions

 injectPersistenceManager (PersistenceManagerInterface $persistenceManager)
 
 __construct (ObjectManagerInterface $objectManager)
 
 add ($object)
 
 remove ($object)
 
 update ($modifiedObject)
 
QueryResultInterface array findAll ()
 
int countAll ()
 
 removeAll ()
 
object null findByUid ($uid)
 
object null findByIdentifier ($identifier)
 
 setDefaultOrderings (array $defaultOrderings)
 
 setDefaultQuerySettings (QuerySettingsInterface $defaultQuerySettings)
 
TYPO3 CMS Extbase Persistence QueryInterface createQuery ()
 
mixed __call ($methodName, $arguments)
 

Protected Member Functions

string getRepositoryClassName ()
 

Protected Attributes

TYPO3 CMS Extbase Persistence PersistenceManagerInterface $persistenceManager
 
TYPO3 CMS Extbase Object ObjectManagerInterface $objectManager
 
string $objectType
 
array $defaultOrderings = array( )
 
TYPO3 CMS Extbase Persistence Generic QuerySettingsInterface $defaultQuerySettings
 

Detailed Description

The base repository - will usually be extended by a more concrete repository.

Definition at line 28 of file Repository.php.

Constructor & Destructor Documentation

◆ __construct()

TYPO3\CMS\Extbase\Persistence\Repository::__construct ( ObjectManagerInterface  $objectManager)

Member Function Documentation

◆ __call()

mixed TYPO3\CMS\Extbase\Persistence\Repository::__call (   $methodName,
  $arguments 
)

Dispatches magic methods (findBy[Property]())

Parameters
string$methodName‪The name of the magic method
string$arguments‪The arguments of the magic method
Exceptions

Definition at line 224 of file Repository.php.

References TYPO3\CMS\Extbase\Persistence\Repository\createQuery().

Referenced by TYPO3\CMS\Extbase\Tests\Unit\Persistence\RepositoryTest\magicCallMethodTriggersAnErrorIfUnknownMethodsAreCalled().

◆ add()

TYPO3\CMS\Extbase\Persistence\Repository::add (   $object)

Adds an object to this repository

Parameters
object$object‪The object to add
Exceptions
Exception

Implements TYPO3\CMS\Extbase\Persistence\RepositoryInterface.

Definition at line 78 of file Repository.php.

◆ countAll()

int TYPO3\CMS\Extbase\Persistence\Repository::countAll ( )

Returns the total number objects of this repository.

Returns
‪int The object count

Implements TYPO3\CMS\Extbase\Persistence\RepositoryInterface.

Reimplemented in TYPO3\CMS\Extensionmanager\Domain\Repository\ExtensionRepository.

Definition at line 130 of file Repository.php.

References TYPO3\CMS\Extbase\Persistence\Repository\createQuery(), and TYPO3\CMS\Extbase\Persistence\QueryInterface\execute().

◆ createQuery()

TYPO3 CMS Extbase Persistence QueryInterface TYPO3\CMS\Extbase\Persistence\Repository::createQuery ( )

Returns a query for objects of this repository

Returns
‪\TYPO3\CMS\Extbase\Persistence\QueryInterface

Implements TYPO3\CMS\Extbase\Persistence\RepositoryInterface.

Reimplemented in TYPO3\CMS\Beuser\Domain\Repository\BackendUserRepository, and TYPO3\CMS\Beuser\Domain\Repository\BackendUserGroupRepository.

Definition at line 204 of file Repository.php.

References TYPO3\CMS\Extbase\Persistence\QueryInterface\setOrderings(), and TYPO3\CMS\Extbase\Persistence\QueryInterface\setQuerySettings().

Referenced by TYPO3\CMS\Extbase\Persistence\Repository\__call(), TYPO3\CMS\Extensionmanager\Domain\Repository\ExtensionRepository\countAll(), TYPO3\CMS\Extbase\Persistence\Repository\countAll(), TYPO3\CMS\Extensionmanager\Domain\Repository\ExtensionRepository\findAll(), TYPO3\CMS\Extbase\Persistence\Repository\findAll(), ExtbaseTeam\BlogExample\Domain\Repository\PostRepository\findAllByBlog(), TYPO3\CMS\Extensionmanager\Domain\Repository\ExtensionRepository\findAllCommunityDistributions(), TYPO3\CMS\Extensionmanager\Domain\Repository\ExtensionRepository\findAllOfficialDistributions(), ExtbaseTeam\BlogExample\Domain\Repository\PostRepository\findAllSortedByCategory(), ExtbaseTeam\BlogExample\Domain\Repository\PostRepository\findByCategory(), TYPO3\CMS\Belog\Domain\Repository\LogEntryRepository\findByConstraint(), TYPO3\CMS\Extensionmanager\Domain\Repository\ExtensionRepository\findByExtensionKeyOrderedByVersion(), ExtbaseTeam\BlogExample\Domain\Repository\PostRepository\findByTagAndBlog(), TYPO3\CMS\Extensionmanager\Domain\Repository\ExtensionRepository\findByVersionRangeAndExtensionKeyOrderedByVersion(), TYPO3\CMS\Extensionmanager\Domain\Repository\ExtensionRepository\findHighestAvailableVersion(), ExtbaseTeam\BlogExample\Domain\Repository\PostRepository\findNext(), TYPO3\CMS\Extensionmanager\Domain\Repository\ExtensionRepository\findOneByCurrentVersionByExtensionKey(), TYPO3\CMS\Extensionmanager\Domain\Repository\ExtensionRepository\findOneByExtensionKeyAndVersion(), ExtbaseTeam\BlogExample\Domain\Repository\PostRepository\findPrevious(), ExtbaseTeam\BlogExample\Domain\Repository\PostRepository\findRecentByBlog(), and ExtbaseTeam\BlogExample\Domain\Repository\PostRepository\findRemaining().

◆ findAll()

◆ findByIdentifier()

object null TYPO3\CMS\Extbase\Persistence\Repository::findByIdentifier (   $identifier)

Finds an object matching the given identifier.

Parameters
mixed$identifier‪The identifier of the object to find
Returns
‪object|null The matching object if found, otherwise NULL

Implements TYPO3\CMS\Extbase\Persistence\RepositoryInterface.

Definition at line 163 of file Repository.php.

Referenced by TYPO3\CMS\Extbase\Persistence\Repository\findByUid().

◆ findByUid()

object null TYPO3\CMS\Extbase\Persistence\Repository::findByUid (   $uid)

Finds an object matching the given identifier.

Parameters
int$uid‪The identifier of the object to find
Returns
‪object|null The matching object if found, otherwise NULL

Implements TYPO3\CMS\Extbase\Persistence\RepositoryInterface.

Definition at line 152 of file Repository.php.

References TYPO3\CMS\Extbase\Persistence\Repository\findByIdentifier().

Referenced by TYPO3\CMS\Extbase\Tests\Unit\Persistence\RepositoryTest\findByUidReturnsResultOfGetObjectByIdentifierCall(), and TYPO3\CMS\Extensionmanager\Domain\Repository\RepositoryRepository\updateRepositoryCount().

◆ getRepositoryClassName()

string TYPO3\CMS\Extbase\Persistence\Repository::getRepositoryClassName ( )
protected

Returns the class name of this class.

Returns
‪string Class name of the repository.

Definition at line 257 of file Repository.php.

Referenced by TYPO3\CMS\Extbase\Persistence\Repository\__construct().

◆ injectPersistenceManager()

TYPO3\CMS\Extbase\Persistence\Repository::injectPersistenceManager ( PersistenceManagerInterface  $persistenceManager)
Parameters
\TYPO3\CMS\Extbase\Persistence\PersistenceManagerInterface$persistenceManager

Definition at line 56 of file Repository.php.

References TYPO3\CMS\Extbase\Persistence\Repository\$persistenceManager.

◆ remove()

TYPO3\CMS\Extbase\Persistence\Repository::remove (   $object)

Removes an object from this repository.

Parameters
object$object‪The object to remove
Exceptions
Exception

Implements TYPO3\CMS\Extbase\Persistence\RepositoryInterface.

Definition at line 92 of file Repository.php.

◆ removeAll()

TYPO3\CMS\Extbase\Persistence\Repository::removeAll ( )

Removes all objects of this repository as if remove() was called for all of them.

Implements TYPO3\CMS\Extbase\Persistence\RepositoryInterface.

Definition at line 139 of file Repository.php.

References TYPO3\CMS\Extbase\Persistence\Repository\findAll().

◆ setDefaultOrderings()

TYPO3\CMS\Extbase\Persistence\Repository::setDefaultOrderings ( array  $defaultOrderings)

Sets the property names to order the result by per default. Expected like this: array( 'foo' => \TYPO3\CMS\Extbase\Persistence\QueryInterface::ORDER_ASCENDING, 'bar' => \TYPO3\CMS\Extbase\Persistence\QueryInterface::ORDER_DESCENDING )

Parameters
array<string,string>‪$defaultOrderings The property names to order by

Implements TYPO3\CMS\Extbase\Persistence\RepositoryInterface.

Definition at line 178 of file Repository.php.

References TYPO3\CMS\Extbase\Persistence\Repository\$defaultOrderings.

◆ setDefaultQuerySettings()

TYPO3\CMS\Extbase\Persistence\Repository::setDefaultQuerySettings ( QuerySettingsInterface  $defaultQuerySettings)

Sets the default query settings to be used in this repository.

A typical use case is an initializeObject() method that creates a QuerySettingsInterface object, configures it and sets it to be used for all queries created by the repository.

Warning: Using this setter fully overrides native query settings created by QueryFactory->create(). This especially means that storagePid settings from configuration are not applied anymore, if not explicitly set. Make sure to apply these to your own QuerySettingsInterface object if needed, when using this method.

Implements TYPO3\CMS\Extbase\Persistence\RepositoryInterface.

Definition at line 194 of file Repository.php.

References TYPO3\CMS\Extbase\Persistence\Repository\$defaultQuerySettings.

Referenced by TYPO3\CMS\Extbase\Domain\Repository\BackendUserGroupRepository\initializeObject(), TYPO3\CMS\Extbase\Domain\Repository\BackendUserRepository\initializeObject(), TYPO3\CMS\Extbase\Domain\Repository\CategoryRepository\initializeObject(), TYPO3\CMS\Extbase\Domain\Repository\FileMountRepository\initializeObject(), TYPO3\CMS\Extensionmanager\Domain\Repository\RepositoryRepository\initializeObject(), TYPO3\CMS\Belog\Domain\Repository\WorkspaceRepository\initializeObject(), TYPO3\CMS\Extensionmanager\Domain\Repository\ExtensionRepository\initializeObject(), and TYPO3\CMS\Belog\Domain\Repository\LogEntryRepository\initializeObject().

◆ update()

TYPO3\CMS\Extbase\Persistence\Repository::update (   $modifiedObject)

Replaces an existing object with the same identifier by the given object

Parameters
object$modifiedObject‪The modified object
Exceptions
Exception

Implements TYPO3\CMS\Extbase\Persistence\RepositoryInterface.

Definition at line 107 of file Repository.php.

Referenced by TYPO3\CMS\Extbase\Tests\Unit\Persistence\RepositoryTest\updateChecksObjectType(), and TYPO3\CMS\Extensionmanager\Domain\Repository\RepositoryRepository\updateRepositoryCount().

Member Data Documentation

◆ $defaultOrderings

array TYPO3\CMS\Extbase\Persistence\Repository::$defaultOrderings = array( )
protected

◆ $defaultQuerySettings

TYPO3 CMS Extbase Persistence Generic QuerySettingsInterface TYPO3\CMS\Extbase\Persistence\Repository::$defaultQuerySettings
protected

◆ $objectManager

TYPO3 CMS Extbase Object ObjectManagerInterface TYPO3\CMS\Extbase\Persistence\Repository::$objectManager
protected

Definition at line 36 of file Repository.php.

Referenced by TYPO3\CMS\Extbase\Persistence\Repository\__construct().

◆ $objectType

string TYPO3\CMS\Extbase\Persistence\Repository::$objectType
protected

Definition at line 40 of file Repository.php.

◆ $persistenceManager

TYPO3 CMS Extbase Persistence PersistenceManagerInterface TYPO3\CMS\Extbase\Persistence\Repository::$persistenceManager
protected