EntityFieldQuery Meta SQL
Categories
Component ID
1138782
Component name
EntityFieldQuery Meta SQL
Component type
module
Maintenance status
Development status
Component security advisory coverage
not-covered
Component created
Component changed
Component body
EntityFieldQuery Meta SQL is a tiny module that lets you execute methods on query objects by registering them to the query metadata system. This allows modules to make full use of the SQL capabilities even if they have to interact with an EntityFieldQuery instance.
Example usage:
/**
* Custom filter handler for views to filter for, or filer out 'empty' values.
*/
class example_handler_filter_has_value extends views_handler_filter_boolean_operator {
function query() {
if (empty($this->value)) {
$this->query->query->addTag('efq_meta_sql');
$this->query->query->addMetaData('efq_meta_sql', array('isNull' => array('example_field')));
}
else {
$this->query->query->addTag('efq_meta_sql');
$this->query->query->addMetaData('efq_meta_sql', array('isNotNull' => array('example_field')));
}
}
}
The example above defines a custom filter handler for views which can be used in combination with efq_views.
