How To use eZOperationHandler::execute

Author Message

Petr Mrzena

Wednesday 30 April 2003 1:06:38 am

I need to create new object instance and publish it in some existing node. Someone told me to use eZOperationHandler, but when I do so, I get this error:

Warning: Invalid argument supplied for foreach() in c:\program files\ez systems\ezpublish\lib\ezutils\classes\ezmoduleoperationinfo.php on line 82

Is there some extra initialization necessary?

Gunnstein Lye

Friday 02 May 2003 8:11:49 am

Show us the code you use, then it's easier to tell what could be wrong.

Petr Mrzena

Monday 05 May 2003 12:47:54 am

include_once( "kernel/classes/ezcontentclass.php" );
include_once( "kernel/classes/eznodeassignment.php");
include_once( "kernel/content/ezcontentoperationcollection.php" );

$node =& eZContentObjectTreeNode::fetch( 2 );
$parentContentObject =& $node->attribute( 'object' );
$sectionID = $parentContentObject->attribute( 'section_id' );

$class =& eZContentClass::fetch( 1 );
$contentObject =& $class->instantiate( 14, $sectionID );
$contentObject->setName( "MyNewFolder" );

$contentObject->store();

$nodeAssignment =& eZNodeAssignment::create( array(
'contentobject_id' => $contentObject->attribute( 'id' ),
'contentobject_version' => $contentObject->attribute( 'current_version' ),
'parent_node' => $node->attribute( 'node_id' ),
'is_main' => 1
)
);
$nodeAssignment->store();
include_once( 'lib/ezutils/classes/ezoperationhandler.php' );
$operationResult =& eZOperationHandler::execute( 'content', 'publish', array( 'object_id' => $contentObject->attribute( 'id' ),
'version' =>1 ) );

$contentObject =& eZContentObject::fetch( $contentObject->attribute( 'id' ) );

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 30 2025 21:40:36
Script start
Timing: Jan 30 2025 21:40:36
Module start 'layout'
Timing: Jan 30 2025 21:40:36
Module start 'content'
Timing: Jan 30 2025 21:40:36
Module end 'content'
Timing: Jan 30 2025 21:40:36
Script end

Main resources:

Total runtime0.0275 sec
Peak memory usage6,144.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0060 588.2344151.2109
Module start 'layout' 0.00600.0042 739.4453220.6875
Module start 'content' 0.01020.0156 960.1328997.8047
Module end 'content' 0.02580.0017 1,957.937533.9922
Script end 0.0275  1,991.9297 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.003010.8762140.0002
Check MTime0.00114.1175140.0001
Mysql Total
Database connection0.00103.661210.0010
Mysqli_queries0.00279.780730.0009
Looping result0.00000.043310.0000
Template Total0.00134.810.0013
Template load0.00103.545110.0010
Template processing0.00031.213210.0003
Override
Cache load0.00072.364910.0007
General
dbfile0.00031.067780.0000
String conversion0.00000.029440.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