graphql_dataloader_pre_get_model
apply_filters( 'graphql_dataloader_pre_get_model', $model, $entry, $key, $this );
This filter allows the model generated by the DataLoader to be filtered. Returning anything other than null here will bypass the default model generation for an object. One example would be WooCommerce Products returning a custom Model for posts of post_type “product”.
- Type: filter
- Group: Model Layer
- Since: 0.0.5
- Source File:
plugins/wp-graphql/src/Data/Loader/AbstractDataLoader.php
Parameters
$model(null): The filtered model to return. Default null$entry(mixed): The entry loaded from the dataloader to be used to generate a Model$key(mixed): The Key used to identify the loaded entry$abstract_data_loader(\WPGraphQL\Data\Loader\AbstractDataLoader): The AbstractDataLoader instance
Source
apply_filters( 'graphql_dataloader_pre_get_model', $model, $entry, $key, $this );
Related
AbstractDataLoader::normalize_entry()inplugins/wp-graphql/src/Data/Loader/AbstractDataLoader.php:357