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.