How to making a new delating trigger?

Author Message

christian bencivenni

Thursday 12 January 2006 8:48:51 am

Hi.
I must modify a DB table when an object is deleted.
I have the workflow ready and the event which will modify the table operative.
What I'm not understand is what I must write in the BODY section of the trigger.
The functions that EZ use to delete an object?
My functions to delete an object?
Nothing?

How can make understandable for my new trigger that it must activate when an object is deleted?

Thanks

christian bencivenni

Friday 13 January 2006 2:32:05 am

I append this lines to operation_definition.php file in kernel/content/:

$OperationList['canceltrigger'] = array (						               'name' => 'canceltrigger',
	               'default_call_method'=> 'kernel/content/ezcontentoperationcollection.php',
	               'class' => 'ezcontentoperationcollection',
	               'parameter_type' => 'standard',
	               'parameters' => array(	
                                 array( 
		 'name' => 'object_id',
		 'type' => 'integer',
		 'required' => true),
	                 array( 
		 'name' => 'version',
		 'type' => 'integer',
		 'required' => true)),
	'keys' => array('object_id'),
	'body' => array(
		array(
			'type' => 'trigger',
			'name' => 'pre_cancel',
			'keys' => array('object_id','version')),
		array(
			'type' => 'method',
			'name' => 'removeOldNodes',
			'frequency' => 'once',
			'method' => 'removeOldNodes' )));

Is it correct?
Then I have an event where modify my personal DB table.
The only deleting function I found is removeOldNodes($idobject, $version) in the ezcontentoperationcollection class.
But when I delete an object from the admin_view nothing appens.
Where is the error?

christian bencivenni

Monday 16 January 2006 1:02:04 am

No one can help me?
Jeez...

Kåre Køhler Høvik

Monday 16 January 2006 1:33:01 am

Hi

You need to add to : kernel/content/removeobject.php

    $operationResult = eZOperationHandler::execute( 'content', 'canceltrigger', array( 'object_id' => $contentObjectID ), null, $useTriggers );

You should also remove version ID from the operation definition.

Override workflow.ini with ( to list it in <eZ_url>/trigger/list ):

[OperationSettings]
AvailableOperations=content_publish;before_shop_confirmorder;shop_checkout;content_canceltrigger

Kåre Høvik

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 31 2025 03:44:39
Script start
Timing: Jan 31 2025 03:44:39
Module start 'layout'
Timing: Jan 31 2025 03:44:39
Module start 'content'
Timing: Jan 31 2025 03:44:39
Module end 'content'
Timing: Jan 31 2025 03:44:39
Script end

Main resources:

Total runtime0.0242 sec
Peak memory usage8,192.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0045 588.1563151.2109
Module start 'layout' 0.00450.0037 739.3672220.6875
Module start 'content' 0.00820.0145 960.05471,001.9297
Module end 'content' 0.02270.0015 1,961.984433.9922
Script end 0.0242  1,995.9766 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002711.0875140.0002
Check MTime0.00114.5495140.0001
Mysql Total
Database connection0.00052.156710.0005
Mysqli_queries0.00228.938730.0007
Looping result0.00000.033410.0000
Template Total0.00104.310.0010
Template load0.00083.246410.0008
Template processing0.00021.014910.0002
Override
Cache load0.00052.231510.0005
General
dbfile0.002811.724880.0004
String conversion0.00000.034440.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