Closed (fixed)
Project:
Drupal core
Version:
7.x-dev
Component:
base system
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
5 Oct 2010 at 11:24 UTC
Updated:
20 Oct 2010 at 13:50 UTC
Jump to comment: Most recent file
Comments
Comment #1
klausiOh, i should have read the commit message "Entity CRUD: fix entity loading of exportables to only add in all defaults when FALSE is passed."
Now I see that entity_load() sets $ids = array() as default, which is totally confusing. The docs say "An array of entity IDs, or FALSE to load all entities.", so a default as array() makes no sense at all. Passing an empty array will always return an empty array. Do we have a core issue for this?
Comment #2
fagoYep, I fixed a bug in the Entity CRUD API controller which erroneously added in all entities in code if an empty array was passed.
As we discussed in person, I think passing an empty array should lead to nothing being loaded. So one can filter an array of ids and pass it to entity_load() - if the array of ids is suddenly empty, still entity_load() acts as expected and does *not* load all entities.
But I agree that the default should be FALSE. Now a call using the defaults like
entity_load('entity_type')is just silly and does nothing, but with the default FALSE you'd get all entities. I think this is a safe improvement to do even that late in the cycle, as I assume currently no one uses a does-nothing function call likeentity_load('entity_type').Patch attached.
Comment #3
fagoComment #4
moshe weitzman commentedmakes sense
Comment #5
dries commentedCommitted to CVS HEAD.