Repository implements RepositoryInterface, SingletonInterface
The base repository - will usually be extended by a more concrete repository.
Tags
Table of Contents
Interfaces
- RepositoryInterface
- Contract for a repository
- SingletonInterface
- "empty" interface for singletons (marker interface pattern)
Properties
- $autoTagging : bool
- $defaultOrderings : array<non-empty-string, QueryInterface::ORDER_*>
- $defaultQuerySettings : QuerySettingsInterface
- Override query settings created by extbase natively.
- $eventDispatcher : EventDispatcherInterface
- $objectType : string
- $persistenceManager : PersistenceManagerInterface
Methods
- __construct() : mixed
- Constructs a new Repository
- add() : mixed
- Adds an object to this repository
- count() : int
- countAll() : int
- Returns the total number objects of this repository.
- createQuery() : QueryInterface
- Returns a query for objects of this repository
- findAll() : QueryResultInterface|array<string|int, mixed>
- Returns all objects of this repository.
- findBy() : QueryResultInterface
- findByIdentifier() : object|null
- Finds an object matching the given identifier.
- findByUid() : object|null
- Finds an object matching the given identifier.
- findOneBy() : object|null
- injectEventDispatcher() : void
- injectFeatures() : void
- injectPersistenceManager() : mixed
- remove() : mixed
- Removes an object from this repository.
- removeAll() : mixed
- Removes all objects of this repository as if remove() was called for all of them.
- setDefaultOrderings() : mixed
- Sets the property names to order the result by per default.
- setDefaultQuerySettings() : mixed
- Sets the default query settings to be used in this repository.
- update() : mixed
- Replaces an existing object with the same identifier by the given object
- addStorageCacheTags() : void
- Add the combination of tablename and storage pid as cache tag.
- addTableToCacheTags() : void
- Add the tablename to the cache tags, depending on the storage page settings.
- getRepositoryClassName() : mixed
- Returns the class name of this class.
Properties
$autoTagging
protected
bool
$autoTagging
$defaultOrderings
protected
array<non-empty-string, QueryInterface::ORDER_*>
$defaultOrderings
= []
$defaultQuerySettings
Override query settings created by extbase natively.
protected
QuerySettingsInterface
$defaultQuerySettings
Be careful if using this, see the comment on setDefaultQuerySettings()
for more insights.
$eventDispatcher
protected
EventDispatcherInterface
$eventDispatcher
$objectType
protected
string
$objectType
Tags
$persistenceManager
protected
PersistenceManagerInterface
$persistenceManager
Methods
__construct()
Constructs a new Repository
public
__construct() : mixed
add()
Adds an object to this repository
public
add(object $object) : mixed
Parameters
- $object : object
-
The object to add
Tags
count()
public
count(array<string|int, mixed> $criteria) : int
Parameters
- $criteria : array<string|int, mixed>
Tags
Return values
intcountAll()
Returns the total number objects of this repository.
public
countAll() : int
Return values
int —The object count
createQuery()
Returns a query for objects of this repository
public
createQuery() : QueryInterface
Tags
Return values
QueryInterfacefindAll()
Returns all objects of this repository.
public
findAll() : QueryResultInterface|array<string|int, mixed>
Tags
Return values
QueryResultInterface|array<string|int, mixed>findBy()
public
findBy(array<string|int, mixed> $criteria[, array<string|int, mixed>|null $orderBy = null ][, int|null $limit = null ][, int|null $offset = null ]) : QueryResultInterface
Parameters
- $criteria : array<string|int, mixed>
- $orderBy : array<string|int, mixed>|null = null
- $limit : int|null = null
- $offset : int|null = null
Tags
Return values
QueryResultInterfacefindByIdentifier()
Finds an object matching the given identifier.
public
findByIdentifier(mixed $identifier) : object|null
Parameters
- $identifier : mixed
-
The identifier of the object to find
Tags
Return values
object|null —The matching object if found, otherwise NULL
findByUid()
Finds an object matching the given identifier.
public
findByUid(int $uid) : object|null
Parameters
- $uid : int
-
The identifier of the object to find
Tags
Return values
object|null —The matching object if found, otherwise NULL
findOneBy()
public
findOneBy(array<string|int, mixed> $criteria[, array<string|int, mixed>|null $orderBy = null ]) : object|null
Parameters
- $criteria : array<string|int, mixed>
- $orderBy : array<string|int, mixed>|null = null
Tags
Return values
object|nullinjectEventDispatcher()
public
injectEventDispatcher(EventDispatcherInterface $eventDispatcher) : void
Parameters
- $eventDispatcher : EventDispatcherInterface
injectFeatures()
public
injectFeatures(Features $features) : void
Parameters
- $features : Features
injectPersistenceManager()
public
injectPersistenceManager(PersistenceManagerInterface $persistenceManager) : mixed
Parameters
- $persistenceManager : PersistenceManagerInterface
remove()
Removes an object from this repository.
public
remove(object $object) : mixed
Parameters
- $object : object
-
The object to remove
Tags
removeAll()
Removes all objects of this repository as if remove() was called for all of them.
public
removeAll() : mixed
setDefaultOrderings()
Sets the property names to order the result by per default.
public
setDefaultOrderings(array<non-empty-string, QueryInterface::ORDER_*> $defaultOrderings) : mixed
Expected like this: array( 'foo' => \TYPO3\CMS\Extbase\Persistence\QueryInterface::ORDER_ASCENDING, 'bar' => \TYPO3\CMS\Extbase\Persistence\QueryInterface::ORDER_DESCENDING )
Parameters
- $defaultOrderings : array<non-empty-string, QueryInterface::ORDER_*>
-
The property names to order by
setDefaultQuerySettings()
Sets the default query settings to be used in this repository.
public
setDefaultQuerySettings(QuerySettingsInterface $defaultQuerySettings) : mixed
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.
Parameters
- $defaultQuerySettings : QuerySettingsInterface
-
The query settings to be used by default
update()
Replaces an existing object with the same identifier by the given object
public
update(object $modifiedObject) : mixed
Parameters
- $modifiedObject : object
-
The modified object
Tags
addStorageCacheTags()
Add the combination of tablename and storage pid as cache tag.
protected
addStorageCacheTags(QueryInterface $query) : void
Parameters
- $query : QueryInterface
addTableToCacheTags()
Add the tablename to the cache tags, depending on the storage page settings.
protected
addTableToCacheTags(QueryInterface $query) : void
Parameters
- $query : QueryInterface
getRepositoryClassName()
Returns the class name of this class.
protected
getRepositoryClassName() : mixed