Forums / Discussions / Issue while calling updateAndPublishObject

Issue while calling updateAndPublishObject

|
|
Next topic
 »
Author Message

Jitesh Rana

Tuesday 23 August 2011 12:03:03 am

Hello,

Issue raised while updating the content object. i have following code.

// Creator ID

$creatorID = 2506;
|// root node 
$parentNodeID = 4042;
$ContentObject = eZContentObject::fetch(7489);

$attributeList = array( 'name' => "Link Library in Italy",  
'link' => "http://www.msn.com"); 
 
// Creates the data import array 
$params = array();
$params['parent_node_id'] = $parentNodeID;
$params['creator_id'] = $creatorID;
$params['class_identifier'] = 'link_library';
$params['language'] = 'ita-IT'; 
$params['attributes'] = $attributeList;

$contentObject = eZContentFunctions::updateAndPublishObject( $ContentObject, $params ); 
 

after execution of the above snippet name of the object gets disappeared. and Modifier changed with anonymous user.

need some help to sort it out.

Thanks

Daniel A. Øien

Tuesday 23 August 2011 12:14:17 am

You might need to capitalise the first reference to $contentObject on the last line:

$ContentObject = eZContentFunctions::updateAndPublishObject( $ContentObject, $params );

Daniel A. Øien
Open Concept SA, Norway
Web: http://openconcept.no/
In English: http://openconcept.no/eng

Jitesh Rana

Tuesday 23 August 2011 1:24:29 am

Hi Daniel,

Thanks for reply. But,

That does not make any sense. it is completely different variable that will be storing the result of eZContentFunctions::updateAndPublishObject( $ContentObject, $params );

André R.

Tuesday 23 August 2011 5:54:08 am

UpdateAndPublishObject does not seem to take creator_id as argument, that is a feature on createAndPublishObject, this is probably why anonymous is modifier. The only params supported by this function is remote_id, section_id, storage_dir, language, storage_dir and attributes (see sdk doc or phpdoc in source code).

As for the other problem, check return value of function, does it return true?

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

Daniel A. Øien

Tuesday 23 August 2011 6:18:11 am

"

it is completely different variable that will be storing the result of eZContentFunctions::updateAndPublishObject( $ContentObject, $params );

"

Sorry, I was a bit quick there - but variables with the same name but different capitalisation always confuse me.

I noticed a "<span>" tag in the attribute list:

 $attributeList = array( 'name' => "Link Library in Italy", <span> 'link' => "http://www.msn.com"); 

Is that present in your source or is it something that got injected by the OE when you made your post?

Daniel A. Øien
Open Concept SA, Norway
Web: http://openconcept.no/
In English: http://openconcept.no/eng

Jitesh Rana

Tuesday 23 August 2011 6:20:41 am

Hello Andre,

I understood the first problem explanation. And, for the other problem, I have checked return value of function it returns 1 (true). though name of the object gets disappeared.

need urgent help.

Thanks

Jitesh Rana

Tuesday 23 August 2011 6:25:01 am

"
"

it is completely different variable that will be storing the result of eZContentFunctions::updateAndPublishObject( $ContentObject, $params );

"

Sorry, I was a bit quick there - but variables with the same name but different capitalisation always confuse me.

I noticed a "<span>" tag in the attribute list:

 $attributeList = array( 'name' => "Link Library in Italy", <span> 'link' => "http://www.msn.com"); 

Is that present in your source or is it something that got injected by the OE when you made your post?

"

It is not there. It was just got injected by the OE.

André R.

Tuesday 23 August 2011 6:28:05 am

And no warnings / errors?
I have not used this api myself, afaik Nico and several others* have used it with sucess though.

* http://share.ez.no/forums/developer/modify-and-publish-object-with-php

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom