Forums / Developer / Problems modifying objects

Problems modifying objects

Author Message

Áncor González

Wednesday 28 April 2004 4:12:59 pm

I'm using ezPublish 3.3-3. I'm trying to write a module and I need to alter existing content object attributes. I'm using setContent function, but it doesn't work as I expected. My code:

 $objectver =& $object->currentVersion();
 $attributes =& $objectver->dataMap();
 $my_attrib =& $attributes["attribname"];
 $my_string = "foo";
 $my_attrib->setContent($my_string);
 //Here, my_attrib->content() returns "foo"
 //but data_text still containts the old value
 $my_attrib->store();
 //This update de DB with the content of data_text, so my
 //changes are ignored

What is the right way to do what I'm trying?

In addition, can anybody write an small working example of a full new content object creation from scratch (settings the attributes, etc)?