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

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

eZ debug

Timing: Jan 23 2025 17:08:18
Script start
Timing: Jan 23 2025 17:08:18
Module start 'layout'
Timing: Jan 23 2025 17:08:18
Module start 'content'
Timing: Jan 23 2025 17:08:18
Module end 'content'
Timing: Jan 23 2025 17:08:18
Script end

Main resources:

Total runtime0.0171 sec
Peak memory usage2,048.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0055 614.4844152.6328
Module start 'layout' 0.00550.0035 767.117239.4844
Module start 'content' 0.00900.0061 806.6016101.6172
Module end 'content' 0.01510.0020 908.218842.2891
Script end 0.0171  950.5078 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002514.5386140.0002
Check MTime0.00116.6335140.0001
Mysql Total
Database connection0.00105.905110.0010
Mysqli_queries0.003117.892330.0010
Looping result0.00000.082210.0000
Template Total0.00169.410.0016
Template load0.00084.953910.0008
Template processing0.00084.433010.0008
Override
Cache load0.00063.364810.0006
General
dbfile0.00126.757580.0001
String conversion0.00000.068240.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs