Skip to content

Instantly share code, notes, and snippets.

@htuscher
Forked from anonymous/MyRepository.php
Last active August 29, 2015 14:06
Show Gist options
  • Save htuscher/b3663585b6a12466acd5 to your computer and use it in GitHub Desktop.
Save htuscher/b3663585b6a12466acd5 to your computer and use it in GitHub Desktop.
<?php
namespace Vendor\Extension\Domain\Repository;
use TYPO3\CMS\Extbase\Configuration\ConfigurationManager;
use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface;
use TYPO3\CMS\Extbase\Persistence\QueryResultInterface;
class MyRepository extends \TYPO3\CMS\Extbase\Persistence\Repository {
/**
* @var \TYPO3\CMS\Extbase\Configuration\ConfigurationManager
* @inject
*/
protected $configurationManager;
/**
* Set default query settings
*/
public function initializeObject() {
/** @var $defaultQuerySettings \TYPO3\CMS\Extbase\Persistence\Generic\Typo3QuerySettings */
$defaultQuerySettings = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Typo3QuerySettings');
// add the pid constraint
$defaultQuerySettings->setRespectStoragePage(FALSE);
$defaultQuerySettings->setRespectSysLanguage(FALSE);
$this->setDefaultQuerySettings($defaultQuerySettings);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment