Building a TYPO3 extension in Extbase/Fluid

Change the settings for your controller/repository queries

You can change certain query settings – either the default settings that apply to the controller as well as the repository methods or for just one repository method.

Since my extension records are all being saved in one Storage Folder I wanted to spare the editors the selection of the Storage Folder in the “Insert Plugin” content element. It is something I usually forgot when inserting a plugin. The Storage Folder is a special type of page within TYPO3 and is saved as “pid” with every record.

File paths are relative to the root of your extension /typo3conf/ext/your_extension/


Find some basic information on setting up repository methods in the topic Adding a non-standard/special plugin

To change the default query settings that apply to the controller methods as well add the following method:

// change default query settings
public function initializeObject() {
        // get the current settings
        $querySettings = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Typo3QuerySettings');
        // change the default setting, whether the storage page ID is ignored by the plugins (FALSE) or not (TRUE - default setting)
        // store the new setting(s)

To change that query setting for only one repository method add the following line to that method (after createQuery() but before execute()):
NOTE: this is not working in controller methods!

public function yourRepositoryMethod($someVarFromController) {
        $query = $this->createQuery();
        // ...
        return $query->execute();
        return $query->execute();

A list of query settings

$querySettings->setRespectStoragePage(FALSE); // ignore the storagePid
$querySettings->setStoragePageIds(array(1, 2, 3)); // set some special storagePids
$querySettings->setRespectEnableFields(FALSE); // ignore enableFields (…is deprecated)
$querySettings->setIgnoreEnableFields(TRUE); // ignore the fields which are defined in TCA in key "enablecolumns"
$querySettings->setEnableFieldsToBeIgnored(array('disabled', 'starttime')); // only ignore single enableFields
$querySettings->setIncludeDeleted(TRUE); // also find the deleted rows
$querySettings->setRespectSysLanguage(FALSE); // ignore the sys_language
$querySettings->setSysLanguageUid(2); // set a special sys_language

Source: Extbase: Query and repository overview