class Query (View source)

Properties

protected ContentQueryParser $parser
protected array $scopes

Methods

__construct(ContentQueryParser $parser)

No description

void
addScope(string $name, QueryScopeInterface $scope)

No description

QueryScopeInterface|null
getScope(string $name)

No description

Pagerfanta|Content|null
getContent(string $textQuery, array $parameters = [])

getContent based on a 'human readable query'.

Pagerfanta|Content|null
getContentByScope(string $scopeName, string $textQuery, array $parameters = [])

No description

getContentForTwig(string $textQuery, array $parameters = [])

Helper to be called from Twig that is passed via a TwigRecordsView rather than the raw records.

Details

__construct(ContentQueryParser $parser)

Parameters

ContentQueryParser $parser

void addScope(string $name, QueryScopeInterface $scope)

Parameters

string $name
QueryScopeInterface $scope

Return Value

void

QueryScopeInterface|null getScope(string $name)

Parameters

string $name

Return Value

QueryScopeInterface|null

Pagerfanta|Content|null getContent(string $textQuery, array $parameters = [])

getContent based on a 'human readable query'.

Used by the twig command {% setcontent %} but also directly. For reference refer to @link https://docs.bolt.cm/templating/content-fetching

Parameters

string $textQuery
array $parameters

Return Value

Pagerfanta|Content|null

Pagerfanta|Content|null getContentByScope(string $scopeName, string $textQuery, array $parameters = [])

Parameters

string $scopeName
string $textQuery
array $parameters

Return Value

Pagerfanta|Content|null

getContentForTwig(string $textQuery, array $parameters = [])

Helper to be called from Twig that is passed via a TwigRecordsView rather than the raw records.

Parameters

string $textQuery The base part like pages or pages/1
array $parameters Parameters like printquery and paging, but also where parameters taken from ... where { foo: bar } ...