Forums / Developer / How to retrieve parent node id from an unpublished object?

How to retrieve parent node id from an unpublished object?

Author Message

Andrea Sudetti

Monday 28 September 2009 3:47:57 am

Hi all,
I have to validate an input during public processing, but I'm not able to retrieve the parent node id of the object submitted before it is published (after submit, I've to check some conditions referring to parent node) ... I know that the node doesn't exist until the object is published but I guess that the parent node id MUST be available...

The question is: how can I retrieve the parent node id inside function validateInput in my custom edit module handler?

I watch in $_SESSION e $_POST variables but the only parent reference is the "redirectURIafterpublish" variable... I can't believe is the only way to get back the parent id...

Suggestions?

Thankyou in advance...

Gaetano Giunta

Monday 28 September 2009 4:19:28 am

Try this:

eZNodeAssignment::fetchForObject( $objectId, $object->attribute( "current_version" ) );

Principal Consultant International Business
Member of the Community Project Board

Andrea Sudetti

Monday 28 September 2009 5:47:59 am

Yessss! Just what I needed!

Thank you mate!

eZ debug

Timing: Jan 18 2025 11:19:23
Script start
Timing: Jan 18 2025 11:19:23
Module start 'content'
Timing: Jan 18 2025 11:19:23
Module end 'content'
Timing: Jan 18 2025 11:19:23
Script end

Main resources:

Total runtime0.7180 sec
Peak memory usage4,096.0000 KB
Database Queries58

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0098 587.9688180.7969
Module start 'content' 0.00980.7055 768.7656535.6328
Module end 'content' 0.71530.0026 1,304.398442.0391
Script end 0.7179  1,346.4375 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00430.6029140.0003
Check MTime0.00140.1884140.0001
Mysql Total
Database connection0.00090.127210.0009
Mysqli_queries0.674793.9638580.0116
Looping result0.00060.0867560.0000
Template Total0.684095.320.3420
Template load0.00350.486520.0017
Template processing0.680594.778720.3403
Template load and register function0.00020.033310.0002
states
state_id_array0.00110.159210.0011
state_identifier_array0.00130.181920.0007
Override
Cache load0.00310.4296160.0002
Sytem overhead
Fetch class attribute can translate value0.00060.080120.0003
Fetch class attribute name0.00100.144840.0003
XML
Image XML parsing0.00070.100820.0004
class_abstraction
Instantiating content class attribute0.00000.001440.0000
General
dbfile0.00080.1159180.0000
String conversion0.00000.000730.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
3content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 10
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs