This site has been archived and you can no longer log in or post new messages. For up-to-date community resources please visit ezplatform.com

eZ Community » Forums » Developer » Get object id from where object...
expandshrink

Get object id from where object relations are added

Get object id from where object relations are added

Wednesday 02 September 2015 8:24:44 am - 1 reply

In a content class i have added a object relations  attribute. Lets say i have added obj-1 and obj-2 through this object relations. When i visit obj-1 or obj-2 in front end i want to know in which object or objects obj-1 or obj-2 was added through object relations. Is it possbile in ezpublish5 legacy? 

Wednesday 02 September 2015 11:27:21 am

Hi,
If I understand what you want to do, it is getting the Object ID of an object(s) located into an attribute's content class having an object relation's type. In other way, you want to get the ID of obj-1 or obj-2 through the attribute of object relations where they are linked. If it's not , don't continue to read this post.
So , for doing this use case, i suggest this :

$content = $contentService->loadContent($id_content_class);

$destinationContentIds= $content->getFieldValue('id_attribute_object_relations);

$arrayOfDestinationContentIds=explode(",",$destinationContentIds);
Hope to be the right answer.
 

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from