diff --git a/src/Storage/Query.php b/src/Storage/Query.php index 3227868f0..b636465ac 100644 --- a/src/Storage/Query.php +++ b/src/Storage/Query.php @@ -5,6 +5,7 @@ namespace Bolt\Storage; use Bolt\Entity\Content; +use Pagerfanta\Adapter\ArrayAdapter; use Pagerfanta\Pagerfanta; class Query @@ -73,9 +74,15 @@ public function getContentByScope(string $scopeName, string $textQuery, array $p * * @param string $textQuery The base part like `pages` or `pages/1` * @param array $parameters Parameters like `printquery` and `paging`, but also `where` parameters taken from `... where { foo: bar } ...` + * + * @return Pagerfanta|Content|null */ public function getContentForTwig(string $textQuery, array $parameters = []) { + if (empty($textQuery)) { + return new Pagerfanta(new ArrayAdapter([])); + } + return $this->getContentByScope('frontend', $textQuery, $parameters); } }