The situation:

  • two entities implement UI controllers
  • both override hook_menu
  • within hook_menu, both call entity_load to load a third, independent entity type

In this situation, the second call to entity_load will return an empty array instead of the entities. This is because the cacheComplete value within the third entity's load function is set to TRUE, but for some reason the entities are not actually available in the cache.

I will try to debug this more tomorrow if I get a chance.

Comments

paulmarbach’s picture

Having the same problem - will investigate a solution.

paulmarbach’s picture

This fixes it, but I'm unsure of the repercussions elsewhere. It seems like checking to make sure that the $conditions array is present there is not necessary and is possibly what's breaking this.

paulmarbach’s picture

fyi it's a core issue, not an entity issue.

Anonymous’s picture

Great, thanks for debugging to that point. Did you find an issue in the core issue queue?

Chris Gillis’s picture

I had the same issue, but used drupal_static() to save the result for the duration of pageload. See the first example here: http://www.lullabot.com/blog/articles/beginners-guide-caching-data-drupal-7

Worked like a charm.

Chris Gillis’s picture

Issue summary: View changes

fix HTML

johnv’s picture

Closing this as a duplicate of paulmarbach's new issue in drupal core's issue queue.
It is very confusing, since both Drupal core as Entity module have an entity.inc file, AND implement a cacheGet() function.
Linclark's patch is also a core patch. paulmarbach's issue gives a more generic case description.
See also #1823926: Loading all entities of a type twice returns no result on second call