Skip to content

Commit 8aaf999

Browse files
committed
BUGFIX: Do not add node type constraint query if no constraints defined
1 parent 101ab5a commit 8aaf999

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

Classes/Domain/Repository/NodeDataRepository.php

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -44,31 +44,33 @@ class NodeDataRepository extends Repository
4444

4545
/**
4646
* @param string $workspaceName
47-
* @param integer $firstResult
48-
* @param integer $maxResults
47+
* @param int $firstResult
48+
* @param int $maxResults
4949
* @return IterableResult
5050
* @throws \Flowpack\ElasticSearch\ContentRepositoryAdaptor\Exception
5151
*/
52-
public function findAllBySiteAndWorkspace($workspaceName, $firstResult = 0, $maxResults = 1000): IterableResult
52+
public function findAllBySiteAndWorkspace(string $workspaceName, int $firstResult = 0, int $maxResults = 1000): IterableResult
5353
{
5454
/** @var QueryBuilder $queryBuilder */
5555
$queryBuilder = $this->entityManager->createQueryBuilder();
56-
57-
$excludedNodeTypes = array_keys(array_filter($this->nodeTypeIndexingConfiguration->getIndexableConfiguration(), static function($value) {
58-
return !$value;
59-
}));
60-
6156
$queryBuilder->select('n.Persistence_Object_Identifier persistenceObjectIdentifier, n.identifier identifier, n.dimensionValues dimensions, n.nodeType nodeType, n.path path')
6257
->from(NodeData::class, 'n')
6358
->where('n.workspace = :workspace AND n.removed = :removed AND n.movedTo IS NULL')
64-
->andWhere($queryBuilder->expr()->notIn('n.nodeType', $excludedNodeTypes))
6559
->setFirstResult((integer)$firstResult)
6660
->setMaxResults((integer)$maxResults)
6761
->setParameters([
6862
':workspace' => $workspaceName,
6963
':removed' => false,
7064
]);
7165

66+
$excludedNodeTypes = array_keys(array_filter($this->nodeTypeIndexingConfiguration->getIndexableConfiguration(), static function($value) {
67+
return !$value;
68+
}));
69+
70+
if(!empty($excludedNodeTypes)) {
71+
$queryBuilder->andWhere($queryBuilder->expr()->notIn('n.nodeType', $excludedNodeTypes));
72+
}
73+
7274
return $queryBuilder->getQuery()->iterate();
7375
}
7476

0 commit comments

Comments
 (0)