Wednesday 21 June 2006 6:30:55 am
Hello,
in this thread, it is explained how to update an entry of an object with a php script: http://ez.no/community/forum/developer/importing_update_entry_if_it_already_exists With similar methods, I know how to create a new object in a script with attributes of early any kind of datatypes. My problem is how to set an 'object relation' attribute? To add an object relation at the contentobject level, I can use this function : eZContentObject::addContentObjectRelation ($toObjectID,
$fromObjectVersion = false,
$fromObjectID = false,
$attributeID = 0)
But this function add a relation between 2 distinct objects, What i want is to set an attribute of type 'object_relation' or 'object_relation_list'. To modify an attribute of "simple" datatype I can do something like : $contentObjectAttribute->setAttribute("data_text", "My new piece of information");
$contentObjectAttribute->store();
with 'object_relation' instead of "data_text".
the function addContentObjectRelation() has a $attributeID parameter which is described like that :
ID of class attribute.
IF > 0 - relations made with attribute ID ("related object(s)" datatype) 0 - regular relations (content object level)
So it seems that I have to use addContentObjectRelation() with the right $attributeID parameter to add
a relation at attribute level, but where can I find the mapping between attributeID and my attribute ?
Am I right ? And is it enough ? should'nt I also use something like $contentObjectAttribute->setAttribute(...) ? Many thanks for help
|