detect new objects in edit handler

Author Message

Marko Žmak

Monday 05 July 2010 10:22:49 am

I have created a custom edit handler that extends eZContentObjectEditHandler and I would like to detect in it if the object being edited is a newly created object, or an existing object that is being reedited. I'm using this code:

$isNewObject = $contentObjectVersion == 1;

Is there a more proper way to do it or this is it?

--
Nothing is impossible. Not if you can imagine it!

Hubert Farnsworth

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

Main resources:

Total runtime1.3830 sec
Peak memory usage4,096.0000 KB
Database Queries46

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0059 591.5547152.6250
Module start 'layout' 0.00590.0023 744.179739.4609
Module start 'content' 0.00821.3735 783.6406468.1250
Module end 'content' 1.38160.0013 1,251.76568.1563
Script end 1.3830  1,259.9219 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00330.2370160.0002
Check MTime0.00140.1035160.0001
Mysql Total
Database connection0.00120.084310.0012
Mysqli_queries1.340696.9347460.0291
Looping result0.00050.0354440.0000
Template Total1.351597.720.6757
Template load0.00230.164620.0011
Template processing1.349297.555820.6746
Template load and register function0.00010.006910.0001
states
state_id_array0.00130.092110.0013
state_identifier_array0.00240.176820.0012
Override
Cache load0.00180.133470.0003
Sytem overhead
Fetch class attribute can translate value0.00090.062710.0009
Fetch class attribute name0.00130.095320.0007
XML
Image XML parsing0.00050.038210.0005
class_abstraction
Instantiating content class attribute0.00000.000320.0000
General
dbfile0.00130.0921180.0001
String conversion0.00000.000640.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
1content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
2content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 7
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs