Last active
August 29, 2015 14:13
-
-
Save mberhorst/73e5f451c461818e91c6 to your computer and use it in GitHub Desktop.
Example for direct access of doctrine queryBuilder in TYPO3 Flow
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
$q = $this->createQuery(); | |
// hack -> we directly access the queryBuilder from the current query $q | |
$qb = ObjectAccess::getProperty($q, 'queryBuilder', TRUE); | |
$qb | |
->andWhere('e.shortName = :term') | |
->setParameter('term', $term); | |
if ($productType) { | |
$qb | |
->leftJoin('e.type', 't') | |
->andWhere('t.value = :productType') | |
->setParameter('productType', $productType); | |
} | |
if ($hasIssue) { | |
$qb | |
->join('e.issues', 'i') | |
->groupBy('e') | |
->having('COUNT(i) > 0'); | |
} | |
return $q->execute(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment