Skip to content

Instantly share code, notes, and snippets.

@rpflamm
Created July 1, 2014 10:51
Show Gist options
  • Save rpflamm/903719f28e88e4d7dceb to your computer and use it in GitHub Desktop.
Save rpflamm/903719f28e88e4d7dceb to your computer and use it in GitHub Desktop.
Try to reduce the joins for the sub propertys in #TYPO3Flow...
Index: flow/Packages/Framework/TYPO3.Flow/Classes/TYPO3/Flow/Persistence/Doctrine/Query.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- flow/Packages/Framework/TYPO3.Flow/Classes/TYPO3/Flow/Persistence/Doctrine/Query.php (revision )
+++ flow/Packages/Framework/TYPO3.Flow/Classes/TYPO3/Flow/Persistence/Doctrine/Query.php (revision )
@@ -528,10 +528,14 @@
$propertyPathParts = explode('.', $propertyPath);
$conditionPartsCount = count($propertyPathParts);
for ($i = 0; $i < $conditionPartsCount - 1; $i++) {
+ if (is_array($this->joins) && $previousJoinAliasKey = array_search($previousJoinAlias . '.' . $propertyPathParts[$i], $this->joins)) {
+ $previousJoinAlias = $previousJoinAliasKey;
+ } else {
- $joinAlias = $propertyPathParts[$i] . $this->joinAliasCounter++;
- $this->queryBuilder->leftJoin($previousJoinAlias . '.' . $propertyPathParts[$i], $joinAlias);
- $this->joins[$joinAlias] = $previousJoinAlias . '.' . $propertyPathParts[$i];
- $previousJoinAlias = $joinAlias;
+ $joinAlias = $propertyPathParts[$i] . $this->joinAliasCounter++;
+ $this->queryBuilder->leftJoin($previousJoinAlias . '.' . $propertyPathParts[$i], $joinAlias);
+ $this->joins[$joinAlias] = $previousJoinAlias . '.' . $propertyPathParts[$i];
+ $previousJoinAlias = $joinAlias;
+ }
}
return $previousJoinAlias . '.' . $propertyPathParts[$i];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment