function _piwik_stats_get_entities in Piwik Statistic Integration 7.2
Returns a list of entity objects only holding entity id's.
Parameters
string $type: The entity type.
string $bundle: The entity bundle.
Return value
array An array of lightweight entity objects as returned from database.
1 call to _piwik_stats_get_entities()
- piwik_stats_get_queue_items in ./
piwik_stats.module - Returns a dataset of fields to fill.
File
- ./
piwik_stats.module, line 724 - Integrates piwik statistics as entity fields.
Code
function _piwik_stats_get_entities($type, $bundle) {
// Get information about entity type.
$entity_info = entity_get_info($type);
// Get all entity id's of a specific type and bundle.
$select = db_select($entity_info['base table'], 'b');
$select
->addField('b', $entity_info['entity keys']['id']);
// Some entity tables neither have revisisons nor bundles.
if (!empty($entity_info['entity keys']['revision'])) {
$select
->addField('b', $entity_info['entity keys']['revision']);
}
if (!empty($entity_info['entity keys']['bundle'])) {
$select
->addField('b', $entity_info['entity keys']['bundle']);
$select
->condition('b.type', $bundle);
}
$entities = $select
->execute()
->fetchAll();
return $entities;
}