Tuesday 04 December 2007 6:31:14 am
Hi,
I'm working in scripts, those script can create the same object in several languages, but right now I have to update de same objects. The problem is that once created the update reset all data and the objects gets empty, here's the code:
$version =& $contentObject->version( $contentObject->attribute( 'current_version' ) );
$version->setAttribute( 'status', EZ_VERSION_STATUS_DRAFT );
$version->store();
$contentObjectAttributes =& $version->attribute( 'data_map' );
// this $fields array as the attributes names of the class with the value to update it.
foreach($fields as $key=>$value){
$contentObjectAttributes["$key"]->setAttribute( 'data_text', $fields[$value] );
$contentObjectAttributes["$key"]->store();
}
$contentObject->store();
include_once( 'lib/ezutils/classes/ezoperationhandler.php' );
eZOperationHandler::execute( 'content', 'publish',
array( 'object_id' => $contentObject->attribute( 'id' ),
'version' => $contentObject->attribute( 'current_version' ) ) );
I really don't no what might be wrong here. I don't know if any problem arise from the fact that each object as 4 versions each one in the right language. Thanks for the help. PiR
|