Forums / Developer / Most commented / Comment51520
Ivo Lukac
Monday 27 July 2009 9:20:49 am
Here we go (if somebody else need it):
<?php class NodeChildrenCountFilter { function NodeChildrenCountFilter() { } function createSqlParts( $params ) { return array('tables' => '', 'joins' => '', 'columns' => ', ( SELECT count(*) FROM ezcontentobject_tree ezcontentobject_tree_2 WHERE ezcontentobject_tree_2.parent_node_id = ezcontentobject_tree.node_id) AS children_count '); } } ?>
Just need to put this extended filter in fetch and sort it by children_count DESC
http://www.linkedin.com/in/ivolukac http://www.netgen.hr/eng/blog http://twitter.com/ilukac