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

eZ debug

Timing: Jan 17 2025 21:17:21
Script start
Timing: Jan 17 2025 21:17:21
Module start 'content'
Timing: Jan 17 2025 21:17:21
Module end 'content'
Timing: Jan 17 2025 21:17:22
Script end

Main resources:

Total runtime0.5575 sec
Peak memory usage4,096.0000 KB
Database Queries208

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0066 597.3125180.8203
Module start 'content' 0.00660.4169 778.1328689.0391
Module end 'content' 0.42350.1339 1,467.1719345.2891
Script end 0.5574  1,812.4609 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00380.6763210.0002
Check MTime0.00130.2383210.0001
Mysql Total
Database connection0.00160.278810.0016
Mysqli_queries0.476685.49172080.0023
Looping result0.00190.34742050.0000
Template Total0.533595.720.2668
Template load0.00200.353920.0010
Template processing0.531595.344020.2658
Template load and register function0.00010.025710.0001
states
state_id_array0.00060.103210.0006
state_identifier_array0.00060.103320.0003
Override
Cache load0.00170.2984480.0000
Sytem overhead
Fetch class attribute can translate value0.00100.177840.0002
Fetch class attribute name0.00090.1638100.0001
XML
Image XML parsing0.00130.238940.0003
class_abstraction
Instantiating content class attribute0.00000.0031120.0000
General
dbfile0.00200.3639340.0001
String conversion0.00000.000930.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
8content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
14content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
4content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
4content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
3content/datatype/view/ezxmltags/quote.tpldatatype/ezxmltext/quote.tplextension/ezwebin/design/ezwebin/override/templates/datatype/ezxmltext/quote.tplEdit templateOverride template
1content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 36
 Number of unique templates used: 8

Time used to render debug report: 0.0003 secs