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

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

eZ debug

Timing: Jan 19 2025 00:08:11
Script start
Timing: Jan 19 2025 00:08:11
Module start 'content'
Timing: Jan 19 2025 00:08:11
Module end 'content'
Timing: Jan 19 2025 00:08:11
Script end

Main resources:

Total runtime0.2170 sec
Peak memory usage2,048.0000 KB
Database Queries141

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0078 587.9688180.7969
Module start 'content' 0.00780.0086 768.7656102.1016
Module end 'content' 0.01640.2005 870.8672530.9219
Script end 0.2169  1,401.7891 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00442.0386200.0002
Check MTime0.00160.7335200.0001
Mysql Total
Database connection0.00090.431910.0009
Mysqli_queries0.151769.90881410.0011
Looping result0.00190.85361390.0000
Template Total0.199992.110.1999
Template load0.00090.411510.0009
Template processing0.199091.733810.1990
Override
Cache load0.00060.285810.0006
Sytem overhead
Fetch class attribute can translate value0.00130.577010.0013
XML
Image XML parsing0.00030.126410.0003
General
dbfile0.01235.6562200.0006
String conversion0.00000.002430.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

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