Using a Query Container

Edit on GitHub

The query container of the current unterminated query is available via $this->getQueryContainer() in the factory of the communication and the business layer and can be injected into any model.

Query container via factory

Executing the Query

You can adjust the query itself, but you should avoid adding more filters or joins because this is a responsibility of the query container only.

<?php
$templateQuery = $this->queryTemplateByPath($path);
$templateQuery->limit(100);
$templateQuery->offset(10);
$templateCollection = $templateQuery->find(); // or findOne()

You can also change the output format, e.g. to array instead of collection:

<?php
$formatter = new SimpleArrayFormatter();
$templateQuery->setFormatter($formatter);