Forums / Setup & design / fetch - sort by date created

fetch - sort by date created

Author Message

Marko Žmak

Friday 21 July 2006 11:47:20 am

I know it is possible to sort nodes in a fetch operator function but is it possible to sort them by the date they were initially created?

--
Nothing is impossible. Not if you can imagine it!

Hubert Farnsworth

Matthew Carroll

Friday 21 July 2006 11:54:22 am

Is 'sort_by', 'published' not what you want?

http://ez.no/doc/ez_publish/technical_manual/3_8/reference/modules/content/fetch_functions/list

Matthew

http://carroll.org.uk

Marko Žmak

Saturday 22 July 2006 10:12:42 am

No, I don't want to sort them by "published date" but by "creation date". Sorting by "published" sorts nodes based on creation date of the last published version. But I wan't to sort them by the creation date of the object, that is the creation date of the first version that was created. Is this possible somehow?

--
Nothing is impossible. Not if you can imagine it!

Hubert Farnsworth

Kristof Coomans

Tuesday 25 July 2006 10:47:05 am

I doubt the documentation is right about that.

The published date only is initialized when the object gets published for the first time (it's still 0). The modified time is changed every time a new version is published.

See kernel/content/ezcontentoperationcollection.php function setObjectStatusPublished, starting from line 184 on trunk rev. 16527

if ( $object->attribute( 'published' ) == 0 )
{
    $object->setAttribute( 'published', mktime() );
}
$object->setAttribute( 'modified', mktime() );

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

Marko Žmak

Tuesday 25 July 2006 11:14:57 pm

Yes Kristof, you're right I just verified it on my site. I think the documentation should be changed in order not to confuse people.

--
Nothing is impossible. Not if you can imagine it!

Hubert Farnsworth