Last inserted NodeID?

Author Message

Carlos Revillo

Friday 15 June 2007 1:25:28 am

Hi. I'm working with a extension. With this extension, a registered used can add new content to database.
I use

include_once( 'lib/ezutils/classes/ezoperationhandler.php' );
$operationResult = eZOperationHandler::execute( 'content', 'publish', array( 'object_id' => $contentObjectID,'version' => 1 ) );

but, how can i get the node_id of the contentobject i have added? I want the user be subscribed to this node he has created so i need the node id for doing something like

$user=&eZUser::currentuser();
 include_once( 'kernel/classes/notification/handler/ezsubtree/ezsubtreenotificationrule.php' );
$rule=eZSubtreeNotificationRule::create($node,$user->attribute("contentobject_id"));
$rule->store();

Thank you.

Nabil Alimi

Friday 15 June 2007 2:07:16 am

Hi Carlos,

You might try something like :

$node = eZContentObjectTreeNode::fetchByContentObjectID( $contentObjectID )

This should retrieve the node related to the content object.

My blog : http://www.starnab.com/ezpublish / http://www.starnab.com/ / http://www.assiki-consulting.com
eZ Publish Freelance developper. Feel free to contact me +33 674 367 057
nabil at assiki d0t fr

Carlos Revillo

Friday 15 June 2007 2:37:57 am

yes. it works. thanks a lot.

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 19 2025 01:04:22
Script start
Timing: Jan 19 2025 01:04:22
Module start 'layout'
Timing: Jan 19 2025 01:04:22
Module start 'content'
Timing: Jan 19 2025 01:04:23
Module end 'content'
Timing: Jan 19 2025 01:04:23
Script end

Main resources:

Total runtime0.6721 sec
Peak memory usage4,096.0000 KB
Database Queries57

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0059 589.0313152.6094
Module start 'layout' 0.00590.0039 741.640639.4297
Module start 'content' 0.00980.6611 781.0703534.4141
Module end 'content' 0.67080.0013 1,315.484412.1875
Script end 0.6721  1,327.6719 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00320.4708160.0002
Check MTime0.00130.1869160.0001
Mysql Total
Database connection0.00060.082910.0006
Mysqli_queries0.628093.4382570.0110
Looping result0.00060.0839550.0000
Template Total0.638194.920.3191
Template load0.00180.272320.0009
Template processing0.636394.669120.3181
Template load and register function0.00010.020110.0001
states
state_id_array0.00090.129210.0009
state_identifier_array0.00080.123420.0004
Override
Cache load0.00150.2170170.0001
Sytem overhead
Fetch class attribute can translate value0.00100.148320.0005
Fetch class attribute name0.00160.238740.0004
XML
Image XML parsing0.00080.119820.0004
class_abstraction
Instantiating content class attribute0.00000.001540.0000
General
dbfile0.00080.1206160.0001
String conversion0.00000.001340.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
3content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
1content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
6content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
3content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 16
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs