protected function EdgeEntityStorageBase::getFromStorage in Apigee Edge 8
Gets entities from the storage.
Parameters
array|null $ids: If not empty, return entities that match these IDs. Return all entities when NULL.
Return value
\Drupal\Core\Entity\EntityInterface[] Array of entities from the storage.
Throws
\Drupal\Core\Entity\EntityStorageException
2 calls to EdgeEntityStorageBase::getFromStorage()
- AppStorage::getFromStorage in src/
Entity/ Storage/ AppStorage.php - Gets entities from the storage.
- EdgeEntityStorageBase::doLoadMultiple in src/
Entity/ Storage/ EdgeEntityStorageBase.php - Performs storage-specific loading of entities.
1 method overrides EdgeEntityStorageBase::getFromStorage()
- AppStorage::getFromStorage in src/
Entity/ Storage/ AppStorage.php - Gets entities from the storage.
File
- src/
Entity/ Storage/ EdgeEntityStorageBase.php, line 251
Class
- EdgeEntityStorageBase
- Base entity storage class for Apigee Edge entities.
Namespace
Drupal\apigee_edge\Entity\StorageCode
protected function getFromStorage(array $ids = NULL) {
$entities = [];
// If ids is an empty array there is nothing to do.
// Probably every entities could have been found in the persistent cache.
// Node::loadMultiple() works the same.
if ($ids === []) {
return $entities;
}
$this
->withController(function (EdgeEntityControllerInterface $controller) use ($ids, &$entities) {
$tmp = [];
// Speed up things by loading only one entity.
if ($ids !== NULL && count($ids) === 1) {
// TODO When user's email changes do not ask Apigee Edge 3 times
// whether a developer exists with the new email address or not.
try {
$entity = $controller
->load(reset($ids));
$tmp[$entity
->id()] = $entity;
} catch (ApiException $e) {
// Entity with id may not exists.
}
}
else {
// There is nothing else we could do we have to load all entities
// from Apigee Edge.
$tmp = $controller
->loadAll();
}
$entities = $this
->processLoadedEntities($ids, $tmp);
});
return $entities;
}