TracksProvidedFields
Trait for input types to track which fields were explicitly provided in the GraphQL request.
This allows mutations to distinguish between a field being missing (don't change it) and explicitly set to null (clear it).
Table of Contents
- $provided_fields : array<string|int, mixed>
- Fields that were explicitly provided in the input.
- mark_provided() : void
- Mark a field as explicitly provided in the input.
- was_provided() : bool
- Check whether a field was explicitly provided in the input.
Properties
$provided_fields
Fields that were explicitly provided in the input.
protected
array<string|int, mixed>
$provided_fields
= array()
Using an underscore prefix to keep it invisible to the ApiBuilder (which only scans public properties for GraphQL fields).
Methods
mark_provided()
Mark a field as explicitly provided in the input.
public
mark_provided(string $field) : void
Parameters
- $field : string
-
The field name.
Return values
void —was_provided()
Check whether a field was explicitly provided in the input.
public
was_provided(string $field) : bool
Parameters
- $field : string
-
The field name.
