-
Notifications
You must be signed in to change notification settings - Fork 11
Open
Description
This is a known issues in the Drupal Entity API module that has not been resolved, presumably because of backward compatibility and custom modules that may have already adapted their own solutions. See these issues 1572466, 1823926 and 1273756
To reproduce
- Create a new entity type that uses
EntityPlusController, or use the contrib module Basic Entity Plus - Create some entities of that type
- In devel PHP window, run this twice:
dpm(entity_load_multiple('MY_TYPE', FALSE));
dpm(entity_load_multiple('MY_TYPE', FALSE));The first output is correct (it includes all entities). The second output is an empty array.
The patch in 1273756 could be partially adapted.
Otherwise, a good workaround is to override EntityPlusController::cacheGet() as explained in 1572466, as follows:
/**
* Implements a controller class for MyEntity.
*/
class MyEntityController extends EntityPlusController {
/**
* Overrides EntityPlusController::cacheGet()
*/
protected function cacheGet($ids, $conditions = array()) {
// Load any available entities from the internal cache.
if ($ids === FALSE && !$conditions) {
return $this->entityCache;
}
return parent::cacheGet($ids, $conditions);
}
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels