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 17 2025 23:52:17
Script start
Timing: Jan 17 2025 23:52:17
Module start 'layout'
Timing: Jan 17 2025 23:52:17
Module start 'content'
Timing: Jan 17 2025 23:52:18
Module end 'content'
Timing: Jan 17 2025 23:52:18
Script end

Main resources:

Total runtime0.6635 sec
Peak memory usage4,096.0000 KB
Database Queries71

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0051 589.8203152.6406
Module start 'layout' 0.00510.0033 742.460939.4844
Module start 'content' 0.00840.6526 781.9453644.2969
Module end 'content' 0.66100.0024 1,426.242220.1250
Script end 0.6634  1,446.3672 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00370.5608160.0002
Check MTime0.00150.2251160.0001
Mysql Total
Database connection0.00070.099910.0007
Mysqli_queries0.592289.2509710.0083
Looping result0.00070.1038680.0000
Template Total0.631895.220.3159
Template load0.00230.344420.0011
Template processing0.629594.880020.3148
Template load and register function0.00020.022910.0002
states
state_id_array0.00110.171310.0011
state_identifier_array0.00120.176820.0006
Override
Cache load0.00200.3033480.0000
Sytem overhead
Fetch class attribute can translate value0.00090.130130.0003
Fetch class attribute name0.00120.1804100.0001
XML
Image XML parsing0.00120.188130.0004
class_abstraction
Instantiating content class attribute0.00000.0066120.0000
General
dbfile0.00130.1939230.0001
String conversion0.00000.001840.0000
Note: percentages do not add up to 100% because some accumulators overlap

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
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_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