creating a new version in a language

Author Message

*- pike

Friday 30 May 2008 12:04:09 pm

Hi

I feel I'm missing the point somewhere ...

I have a published object in one language. I want to add attributes in another language. The object doesn't have attributes for this other language yet, so I create a new version - I rather wouldn't, but it's a safe way to go.

So taking the code from here
http://ezpedia.org/wiki/en/ez/creating_new_content_object_versions_with_php

$newVersion =& $object->createNewVersion();
$result = eZOperationHandler::execute( 'content', 'publish', array(
      'object_id' => $object->attribute( 'id' ), 
      'version' => $newVersion->attribute( 'version' ) 
) );

That works. However, if I do

$newVersion =& $object->createNewVersion($orgversionnr);
$result = eZOperationHandler::execute( 'content', 'publish', array(
      'object_id' => $object->attribute( 'id' ),
      'version' => $newVersion->attribute( 'version' ) ) 
);

I get 2 published versions, with all attributes appearing twice in each ??

What I obviously want to do, is

$newVersion =& $object->createNewVersion($orgversionnr,true,$newlocale,$orglocale);

But that makes the mess even bigger - two published objects, each in one language, with all the attributes doubled.

Is this a bug, or am I poking at the wrong method ?

confused,
*-pike

---------------
The class eZContentObjectTreeNode does.

*- pike

Friday 30 May 2008 12:19:02 pm

anyhew .. i hacked my way around it now.

i stole code from contentObject::copyVersion to instantiate new (or copy existing) attributes into the current version of the object.

then i store the version and it's done. oh, if the version was already published i need to publish it again, or the admin will be very confused.

whatever works :-)

*-pike

---------------
The class eZContentObjectTreeNode does.

Olivier Versanne

Monday 13 July 2009 9:43:51 am

Hi,

I think I have the same problem, but after calling copyVersion in my new language, my DataMap is empty.

So, could you give us an example of your working code?

Thanks *- pike!

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.