Some of functions like EntityAPIController::load($id) can use named indentity instead of drupal internal id.
But some of thme don't: EntityAPIController::resetCache() accepts only drupal internal integer id.
On direct call programmer can check it out from the code, but I stuck on that problem while using entity_load_unchanged() trying to get 'orignal' entity from DB and always getting me static cache because I was giving entity indentity() as id parameter.
It's confusing when sometimes you can use $name of the entity (load() method) and sometimes not (resetCache() method).
I guess resetCache() must check for given id and clear needed cache as its done in ::load() function:
// Only do something if loaded by names.
if ($this->nameKey == $this->idKey || is_numeric(reset($ids))) {
....
}
Comment | File | Size | Author |
---|---|---|---|
#2 | _entity_2610852_resetCacheByName_#2_D7-1.6.patch | 1.31 KB | SlyK |
Comments
Comment #2
SlyK CreditAttribution: SlyK commentedHere is what works for me:
P.S. In patch there are no "&" so it's broken.