Created
September 4, 2014 09:45
-
-
Save anonymous/c344b2a455517358c229 to your computer and use it in GitHub Desktop.
Extbase 6.2 modify default query settings in repository
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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