Last active
February 26, 2018 11:56
-
-
Save htuscher/d8a2b0954b06d75786f2 to your computer and use it in GitHub Desktop.
TYPO3 Extbase 6.2 debug generated query
This file contains 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\Ext\Domain\Repository | |
use TYPO3\CMS\Core\Utility\GeneralUtility; | |
use TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbQueryParser; | |
use TYPO3\CMS\Extbase\Persistence\QueryInterface; | |
use TYPO3\CMS\Extbase\Persistence\Repository; | |
use TYPO3\CMS\Extbase\Utility\DebuggerUtility; | |
class MyRepository extends Repository { | |
protected function findByAnything() { | |
$query = $this->createQuery(); | |
$query->matching( | |
$query->logicalAnd( | |
$query->equals('my_attribute1', 'anyval1'), | |
$query->equals('my_attribute2', 'anyval2') | |
) | |
); | |
/** @var Typo3DbQueryParser $queryParser */ | |
$queryParser = GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Storage\\Typo3DbQueryParser'); | |
DebuggerUtility::var_dump($queryParser->preparseQuery($query)); | |
DebuggerUtility::var_dump($queryParser->parseQuery($query)); | |
return $query->execute(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment