Hi,
I save an object with metadatas:
//...etc.
$my_obj->title = $title;
$my_obj->my_obj_type = $type;
$my_obj->my_obj_category = $category;
$my_obj->description = $description;
// Now save the object
if (!$my_obj->save()) {
register_error(elgg_echo("my_obj:error"));
forward($_SERVER['HTTP_REFERER']);
}
//...etc.
Then I want to get the metadata from the database with elgg_get_entities_from_metadata
But I get just the title and the description, and there is no my_obj_type or my_obj_category!
Why???
//My code about the query:
$params = Array (
"types" => "object",
"subtypes" => "my_obj",
"limit" => 100,
"order_by" => "time_updated DESC",
"metadata_name_value_pairs" => array (
array("name" => 'my_obj_type'),
array("name" => 'my_obj_category')
)
);
$my_obj = elgg_get_entities_from_metadata($params);
And what I get on print_r($my_obj);
Array ( [0] => ElggObject Object ( [attributes:protected] => Array ( [guid] => 89 [type] => object [subtype] => 11 [owner_guid] => 4 [container_guid] => 4 [site_guid] => 1 [access_id] => 1 [time_created] => 1317631059 [time_updated] => 1317631059 [last_action] => 1317631059 [enabled] => yes [tables_split] => 2 [tables_loaded] => 2 [title] => Title of my object [description] => Some text here :) ) [url_override:protected] => [icon_override:protected] => [temp_metadata:protected] => Array ( ) [temp_annotations:protected] => Array ( ) [volatile:protected] => Array ( ) [valid:ElggEntity:private] => )
)
How can I get my other metadatas?
Thanks for the help!
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.
- János@horvathjanos

János - 0 likes
- Cash@costelloc

Cash - 0 likes
- János@horvathjanos

János - 0 likes
You must log in to post replies.oh, sorry, I forgot, it's under elgg 1.7.*
The metadata is loaded on demand. Grab an element of the array and see:
echo $my_obj[0]->my_obj_type;
I understand now, yeah it really works, thanks Cash! :)