Find the Exponential Software extensions you want
| UNIX name | Owner | Status |
|---|---|---|
| ezplatform-query-fieldtype-original | 7x | stable |
| Version | Compatible with |
|---|---|
| N/A | N/A |
This Field Type will let a content manager map an executable Repository Query to a Field.
Example use-cases:
The idea is to move content and structure logic implemented in controllers and templates
to the repository itself.
Add the package to the requirements:
composer require ezsystems/ezplatform-query-fieldtype:^1.0@dev
Add the package to app/AppKernel.php:
$bundles = [
// ...
new EzSystems\EzPlatformQueryFieldType\Symfony\EzSystemsEzPlatformQueryFieldTypeBundle(),
];
Add the bundle routes to config/routing.yaml:
ezplatform.query_fieldtype.routes:
resource: '@EzSystemsEzPlatformQueryFieldTypeBundle/Resources/config/routing/'
type: directory
Add a Content query field to a content type.
In the Field Definition settings, select a Query Type from the list, as well as the content type that is returned by that field.
Parameters are used to build the query on runtime. They are either static, or mapped to properties from the content
the field value belongs to. The syntax YAML, with the key being the name of a query type parameter, and the value
either a scalar, or an expression.
The following variables are available for use in expressions:
A simple example, for a LocationChildren query type that expects:
parent_location_id: "@=mainLocation.id"
content_types: "@=returnedType"
See the examples directory for full examples.