Skip to main content Skip to page footer

Often used methods in Extbase repositories

A collection of some useful methods when working with Extbase repositories, e.g. accessing the database from an Extbase extension.

In this post I show you some possibilities on how I do some changes on Extbase repositories when needed.

Some example should explain how to change the repository settings dynamically via Controller in an Extbase extension.

Default Query settings in Controller

With big repositories I often use a method to set repository settings dynamically, for example with the following method:

 * @param bool $respectStoragePage
 * @param bool $includeDeleted
 * @param bool $ignoreEnableFields
 * @param bool $respectSysLanguage
 * @param array $storagePageIds
 * @return object|Typo3QuerySettings
protected function getDefaultQuerySettings(
	$respectStoragePage = false,
	$includeDeleted = false,
	$ignoreEnableFields = true,
	$respectSysLanguage = false,
	$storagePageIds = []
) {
	/** @var $defaultQuerySettings Typo3QuerySettings */
	$objectManager = GeneralUtility::makeInstance(ObjectManager::class);
	$defaultQuerySettings = $objectManager->get(Typo3QuerySettings::class);
	if (!empty($storagePageIds)) {
	return $defaultQuerySettings;


Then it is possible to use it in the repository like this:

 * My special action
 * @return void
 * @throws
public function mySpecialAction(): void
	$storagePids = [123,234];
	$defaultQuerySettings = $this->getDefaultQuerySettings(
	$user = $this->frontendUserRepository->findAll();

			'user' => $user,