function Filter::createFromQueryParameter
Same name in other branches
- 8.9.x core/modules/jsonapi/src/Query/Filter.php \Drupal\jsonapi\Query\Filter::createFromQueryParameter()
- 10 core/modules/jsonapi/src/Query/Filter.php \Drupal\jsonapi\Query\Filter::createFromQueryParameter()
- 11.x core/modules/jsonapi/src/Query/Filter.php \Drupal\jsonapi\Query\Filter::createFromQueryParameter()
Creates a Sort object from a query parameter.
Parameters
mixed $parameter: The `filter` query parameter from the Symfony request object.
\Drupal\jsonapi\ResourceType\ResourceType $resource_type: The JSON:API resource type.
\Drupal\jsonapi\Context\FieldResolver $field_resolver: The JSON:API field resolver.
Return value
self A Sort object with defaults.
10 calls to Filter::createFromQueryParameter()
- EntityResource::getJsonApiParams in core/
modules/ jsonapi/ src/ Controller/ EntityResource.php - Extracts JSON:API query parameters from the request.
- FilterTest::testCreateFromQueryParameter in core/
modules/ jsonapi/ tests/ src/ Kernel/ Query/ FilterTest.php - @covers ::createFromQueryParameter @dataProvider parameterProvider
- FilterTest::testCreateFromQueryParameterNested in core/
modules/ jsonapi/ tests/ src/ Kernel/ Query/ FilterTest.php - @covers ::createFromQueryParameter
- FilterTest::testInvalidFilterPathDueMissingMetaPrefixReferenceFieldWithMetaProperties in core/
modules/ jsonapi/ tests/ src/ Kernel/ Query/ FilterTest.php - @covers ::queryCondition
- FilterTest::testInvalidFilterPathDueToElidedSoleProperty in core/
modules/ jsonapi/ tests/ src/ Kernel/ Query/ FilterTest.php - @covers ::queryCondition
File
-
core/
modules/ jsonapi/ src/ Query/ Filter.php, line 155
Class
- Filter
- Gathers information about the filter parameter.
Namespace
Drupal\jsonapi\QueryCode
public static function createFromQueryParameter($parameter, ResourceType $resource_type, FieldResolver $field_resolver) {
$expanded = static::expand($parameter);
foreach ($expanded as &$filter_item) {
if (isset($filter_item[static::CONDITION_KEY][EntityCondition::PATH_KEY])) {
$unresolved = $filter_item[static::CONDITION_KEY][EntityCondition::PATH_KEY];
$operator = $filter_item[static::CONDITION_KEY][EntityCondition::OPERATOR_KEY];
$filter_item[static::CONDITION_KEY][EntityCondition::PATH_KEY] = $field_resolver->resolveInternalEntityQueryPath($resource_type, $unresolved, $operator);
}
}
return new static(static::buildEntityConditionGroup($expanded));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.