Closed (fixed)
Project:
Entity API
Version:
7.x-1.x-dev
Component:
Entity Metadata
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
10 Feb 2010 at 20:59 UTC
Updated:
2 Mar 2010 at 15:30 UTC
Since the $user object is partail when doing global $user, I find myself needing to user_load() it before. It would be nice if the signature was:
entity_metadata_wrapper(($type, $data = NULL, array $info = array(), $reload = TRUE) {
if ($reload && !empty($data)) {
$object = reset(entity_load($type, array($data)));
}
makes sense? roll a patch?
Comments
Comment #1
fagoHm, not really as this function is also used for non entities. But I agree that might be useful, so best let's add a separate function that just takes the entity id for that.
Anyway imho it would make sense to support lazy-loading lists of referenced entities - theoretically important when the list become huge. Don't know whether this is going to be the case though, if it is I think it should be doable by using an object implementing ArrayAccess instead of a plain array.
Comment #2
fago>Anyway imho it would make sense to support lazy-loading lists of referenced entities - theoretically important when the list become huge.
I just made that possible easily as entities are internally treated by their ids now. :) Also you may create the wrapper by passing the id, e.g.: