Pb retrieving the node id inside a datatype (if version==1)

Author Message

Xavier Dutoit

Friday 26 January 2007 2:28:04 am

Hi,

I'm developing a new datatype and I need to know the node id of the object that contains the attribute.

    function postStore( &$objectAttribute )
    {
        include_once( 'kernel/classes/ezcontentobject.php' );
        $object =& eZContentObject::fetch( $objectAttribute->ContentObjectID );
        $mainNodeID = $object->attribute( 'main_node_id' );
      return true;
    }

This works fine, but the first time I save the object (because the node id doesn't exist yet). Is it possible to find the temporary node id or is there a method that is called after the object has really be published or ... ?

      if ( ($objectAttribute->Version == 1 ) {
         die ("where or how do I find the node id ?");

Idea, suggestion ?
X+

http://www.sydesy.com

Kristof Coomans

Friday 26 January 2007 3:37:04 am

Hi Xavier

There is a datatype function called at the end of the publish operation: onPublish

independent eZ Publish developer and service provider | http://blog.coomanskristof.be | http://ezpedia.org

Xavier Dutoit

Friday 26 January 2007 6:03:42 am

Thanks.

http://pubsvn.ez.no/doxygen/ezcontentobjectattribute_8php-source.html#l00759

calling
http://pubsvn.ez.no/doxygen/ezdatatype_8php-source.html#l00639

My datatype is going to end up in the svn soon...

http://www.sydesy.com

Kristof Coomans

Friday 26 January 2007 6:54:59 am

Can you already give us a tip about what it's going to do? :-)

independent eZ Publish developer and service provider | http://blog.coomanskristof.be | http://ezpedia.org

Xavier Dutoit

Friday 26 January 2007 7:23:38 am

Hi sure,

That's a rssfeed datatype. On several of my web sites, I have a directory of sites (type links) and if they have a rss feed, I import the items under them.

Doing that with the current interface is a real pain :
1) create the link,
2) go to rss,
3) create a new rss import with the same name than the link you just created
4) change the type of the content class for the items (no way I want to create folders, as offered by default)
5) set the right attributes,
6) browse the destination node to pick up the link you just created
7) find again the url of the rss you had on your clipboard at 1), but since you had too many manipulations in the meantime, you lost it
8) Save

When they want to add more than two, they usually have a nervous break down (or want to kill me).

With the new rssfeed datatype added on the link class, you just put the rss address at the same time than you create the link and that's it, it creates the import in the background.

Does it make sense ?

X+

http://www.sydesy.com

Xavier Dutoit

Friday 26 January 2007 8:26:41 am

This is on the svn and the project has been created http://ez.no/community/contribs/datatypes/rss_import

And the forum thread about it:

http://ez.no/community/forum/developer/new_datatype_rss_import

http://www.sydesy.com

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:08:27
Script start
Timing: Jan 19 2025 01:08:27
Module start 'layout'
Timing: Jan 19 2025 01:08:27
Module start 'content'
Timing: Jan 19 2025 01:08:28
Module end 'content'
Timing: Jan 19 2025 01:08:28
Script end

Main resources:

Total runtime0.8648 sec
Peak memory usage4,096.0000 KB
Database Queries66

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0050 589.4141152.6563
Module start 'layout' 0.00500.0036 742.070339.5078
Module start 'content' 0.00860.8547 781.5781583.2813
Module end 'content' 0.86320.0016 1,364.859416.0938
Script end 0.8648  1,380.9531 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00330.3768160.0002
Check MTime0.00140.1610160.0001
Mysql Total
Database connection0.00070.083010.0007
Mysqli_queries0.797692.2300660.0121
Looping result0.00060.0669640.0000
Template Total0.835796.620.4179
Template load0.00230.270920.0012
Template processing0.833496.359520.4167
Template load and register function0.00010.011810.0001
states
state_id_array0.00120.135410.0012
state_identifier_array0.00100.115620.0005
Override
Cache load0.00210.2401470.0000
Sytem overhead
Fetch class attribute can translate value0.00060.068220.0003
Fetch class attribute name0.00160.181880.0002
XML
Image XML parsing0.00090.099320.0004
class_abstraction
Instantiating content class attribute0.00000.0035120.0000
General
dbfile0.00130.1553220.0001
String conversion0.00000.000840.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
6content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
6content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
10content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
2content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
3content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 29
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs