Skip to content

Commit

Permalink
Merge pull request #1576 from bolt/fix/reset-setSingleFetchMode
Browse files Browse the repository at this point in the history
Re-set `setSingleFetchMode` to ensure returning a pager, if needed
  • Loading branch information
bobdenotter authored Jun 29, 2020
2 parents 7446dee + cfa2b18 commit b4beeea
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/DataFixtures/ContentFixtures.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ private function loadContent(ObjectManager $manager): void
}

$refKey = sprintf('content_%s_%s', $contentType['slug'], $content->getSlug());
$this->addReference($refKey, $content);
$this->setReference($refKey, $content);

$manager->persist($content);
}
Expand Down
4 changes: 4 additions & 0 deletions src/Storage/Handler/SelectQueryHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ public function __invoke(ContentQueryParser $contentQuery)
/** @var SelectQuery $selectQuery */
$selectQuery = $contentQuery->getService('select');

// Note: This might seem superfluous, but if we "re-use" $contentQuery,
// this needs resetting.
$selectQuery->setSingleFetchMode(null);

$selectQuery->setQueryBuilder($qb);
$selectQuery->setContentTypeFilter($contentQuery->getContentTypes());
$selectQuery->setParameters($contentQuery->getParameters());
Expand Down
2 changes: 1 addition & 1 deletion src/Storage/SelectQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ public function getSingleFetchMode(): ?bool
/**
* Turns single fetch mode on or off.
*/
public function setSingleFetchMode(bool $value): void
public function setSingleFetchMode(?bool $value): void
{
$this->singleFetchMode = $value;
}
Expand Down

0 comments on commit b4beeea

Please sign in to comment.