Skip to content

Instantly share code, notes, and snippets.

@htuscher
Last active February 26, 2018 11:56
Show Gist options
  • Save htuscher/d8a2b0954b06d75786f2 to your computer and use it in GitHub Desktop.
Save htuscher/d8a2b0954b06d75786f2 to your computer and use it in GitHub Desktop.
TYPO3 Extbase 6.2 debug generated query
<?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