A little trick that I've learned for debugging a call to the Elgg API that involves a database call is to wrap it with $CONFIG->debug. For example:
$CONFIG->debug = true;
$images = get_entities('object', 'blog', $guid, '', 25);
$CONFIG->debug = false;
This will write the query to the error log giving you a chance to see what you are doing wrong (or if there is a bug in the Elgg framework). Make sure that the global $CONFIG is available within the context. This works fine with versions up to 1.6. Unknown how this will work on 1.7 and beyond.
Update: For Elgg 1.7 and above you need to do this:
$CONFIG->debug = 'NOTICE';
$images = get_entities('object', 'blog', $guid, '', 25);
unset($CONFIG->debug);
This assumes that you have debugging turned off. If you have it set to something else (like 'ERROR'), you should set it back to that setting.
Leave a comment