$messages is an array of objects, you can't output it as a string.
I would create an export function and export it as an array.
function export_message($message) {
return [
'guid' => $message->guid,
'message' => $message->description,
'toId' => $message->toId,
'time_created' => $message->time_created,
// whatever other info you might need
];}
Then you can use that in your service
$messages = elgg_get_entities_from_metadata(...);
$exported = [];
foreach ($messages as $m) {
$exported[] = export_message($m);
}
return $exported;
Thank you very much Matt.
Your reply was very helpful
Kind Regards
Alberto
info@elgg.org
Security issues should be reported to security@elgg.org!
©2014 the Elgg Foundation
Elgg is a registered trademark of Thematic Networks.
Cover image by Raül Utrera is used under Creative Commons license.
Icons by Flaticon and FontAwesome.