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!

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 01:16:25
Script start
Timing: Jan 31 2025 01:16:25
Module start 'layout'
Timing: Jan 31 2025 01:16:25
Module start 'content'
Timing: Jan 31 2025 01:16:26
Module end 'content'
Timing: Jan 31 2025 01:16:26
Script end

Main resources:

Total runtime0.8585 sec
Peak memory usage8,192.0000 KB
Database Queries57

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0045 588.3906151.2422
Module start 'layout' 0.00450.0040 739.6328220.7500
Module start 'content' 0.00850.8490 960.38284,437.9844
Module end 'content' 0.85760.0009 5,398.36727.7813
Script end 0.8584  5,406.1484 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00390.4569160.0002
Check MTime0.00140.1631160.0001
Mysql Total
Database connection0.00070.083710.0007
Mysqli_queries0.767189.3612570.0135
Looping result0.00080.0900550.0000
Template Total0.808694.220.4043
Template load0.00270.309920.0013
Template processing0.805993.874320.4029
Template load and register function0.00160.186810.0016
states
state_id_array0.00110.129910.0011
state_identifier_array0.00070.086220.0004
Override
Cache load0.00220.2578160.0001
Sytem overhead
Fetch class attribute can translate value0.00200.229720.0010
Fetch class attribute name0.00320.369340.0008
XML
Image XML parsing0.00280.323520.0014
class_abstraction
Instantiating content class attribute0.00000.001540.0000
General
dbfile0.00330.3807160.0002
String conversion0.00000.000940.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
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_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