public function RestfulEntityBase::getList in RESTful 7
Get a list of entities.
Return value
array Array of entities, as passed to RestfulEntityBase::viewEntity().
Throws
Overrides RestfulDataProviderEFQ::getList
1 call to RestfulEntityBase::getList()
- RestfulEntityBaseUser::getList in plugins/
restful/ RestfulEntityBaseUser.php - Overrides \RestfulEntityBase::getList().
2 methods override RestfulEntityBase::getList()
- RestfulEntityBaseMultipleBundles::getList in plugins/
restful/ RestfulEntityBaseMultipleBundles.php - Overrides RestfulEntityBase::getList().
- RestfulEntityBaseUser::getList in plugins/
restful/ RestfulEntityBaseUser.php - Overrides \RestfulEntityBase::getList().
File
- plugins/
restful/ RestfulEntityBase.php, line 110 - Contains RestfulEntityBase.
Class
- RestfulEntityBase
- An abstract implementation of RestfulEntityInterface.
Code
public function getList() {
$request = $this
->getRequest();
$autocomplete_options = $this
->getPluginKey('autocomplete');
if (!empty($autocomplete_options['enable']) && isset($request['autocomplete']['string'])) {
// Return autocomplete list.
return $this
->getListForAutocomplete();
}
$entity_type = $this->entityType;
$result = $this
->getQueryForList()
->execute();
if (empty($result[$entity_type])) {
return array();
}
$ids = array_keys($result[$entity_type]);
// Pre-load all entities if there is no render cache.
$cache_info = $this
->getPluginKey('render_cache');
if (!$cache_info['render']) {
entity_load($entity_type, $ids);
}
$return = array();
// If no IDs were requested, we should not throw an exception in case an
// entity is un-accessible by the user.
foreach ($ids as $id) {
if ($row = $this
->viewEntity($id)) {
$return[] = $row;
}
}
return $return;
}