Forums / General / Last inserted NodeID?

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.

eZ debug

Timing: Jan 19 2025 03:28:51
Script start
Timing: Jan 19 2025 03:28:51
Module start 'content'
Timing: Jan 19 2025 03:28:51
Module end 'content'
Timing: Jan 19 2025 03:28:51
Script end

Main resources:

Total runtime0.0209 sec
Peak memory usage2,048.0000 KB
Database Queries4

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0070 588.8438180.8516
Module start 'content' 0.00700.0067 769.695393.9297
Module end 'content' 0.01360.0072 863.625070.7031
Script end 0.0208  934.3281 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002411.3770120.0002
Check MTime0.00105.0190120.0001
Mysql Total
Database connection0.00063.056410.0006
Mysqli_queries0.004219.902840.0010
Looping result0.00000.110620.0000
Template Total0.006832.510.0068
Template load0.00104.735110.0010
Template processing0.005827.757010.0058
Override
Cache load0.00073.122510.0007
General
dbfile0.002512.0110100.0003
String conversion0.00000.034230.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/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