1

-I need to create one entity (need to do coding)- that I created already, now want to create another entity, lets say "Entity 2"( term(taxonomy, param1, param2, description( it will have multiple values- multiple description). Now I need to add entity 2 as field for entity 1. Entity 1 can have multiple entities of type "Entity 2"

closed as unclear what you're asking by kiamlaluno May 5 '17 at 20:14

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

0

Once you have the ID of the new entities, it's as simple as:

$new_entity->field_foo[LANGUAGE_NONE][0]['target_id'] = $other_entity_id;
$new_entity->field_foo[LANGUAGE_NONE][1]['target_id'] = $yet_another_entity_id;

I've assumed the field type is Entity Reference, YMMV for other types.

Not the answer you're looking for? Browse other questions tagged or ask your own question.