Filter
class Filter (View source)
| internal | JSON:API maintains no PHP API since its API is the HTTP API. This class may change at any time and this will break any dependencies on it. |
Gathers information about the filter parameter.
Constants
| KEY_NAME |
The JSON:API filter key name. |
| ROOT_ID |
The key for the implicit root group. |
| CONDITION_KEY |
Key in the filter[ |
| GROUP_KEY |
Key in the filter[ |
| MEMBER_KEY |
Key in the filter[ |
Properties
| protected string | $root | The root condition group. |
Methods
Gets the root condition group.
Applies the root condition to the given query.
Creates a Sort object from a query parameter.
Expands any filter parameters using shorthand notation.
Expands a filter item in case a shortcut was used.
Denormalizes the given filter items into a single EntityConditionGroup.
Organizes the flat, normalized filter items into a tree structure.
Details
__construct(EntityConditionGroup $root)
Constructs a new Filter object.
root()
Gets the root condition group.
ConditionInterface
queryCondition(QueryInterface $query)
Applies the root condition to the given query.
protected ConditionInterface
buildGroup(QueryInterface $query, EntityConditionGroup $condition_group)
Applies the root condition to the given query.
static Filter
createFromQueryParameter(mixed $parameter, ResourceType $resource_type, FieldResolver $field_resolver)
Creates a Sort object from a query parameter.
static protected array
expand(array $original)
Expands any filter parameters using shorthand notation.
static protected array
expandItem(string $filter_index, array $filter_item)
Expands a filter item in case a shortcut was used.
Possible cases for the conditions:
- filter[uuid][value]=1234.
- filter[0][condition][field]=uuid&filter[0][condition][value]=1234.
- filter[uuid][condition][value]=1234.
- filter[uuid][value]=1234&filter[uuid][group]=my_group.
static protected EntityConditionGroup
buildEntityConditionGroup(array $items)
Denormalizes the given filter items into a single EntityConditionGroup.
static protected EntityConditionGroup
buildTree(array $root, array $items)
Organizes the flat, normalized filter items into a tree structure.