Forums / Setup & design / Difference between list and tree

Difference between list and tree

Author Message

John van der Boom

Friday 08 August 2003 5:07:30 am

I've been working with eZ for 4 months now, but I still can't see the difference between the parameters "list" and "tree" of the fetch operator.

What's the difference and when do I used the one or the other?

Paul Borgermans

Monday 11 August 2003 10:24:57 am

There isn't any difference. Both functions call the same class methods. Up to this point I don't know what the original intention was.

-paul

eZ Publish, eZ Find, Solr expert consulting and training
http://twitter.com/paulborgermans

John van der Boom

Monday 11 August 2003 12:49:35 pm

hehe ok :)

Tristan Koen

Wednesday 13 August 2003 11:57:55 pm

In my experience, there is a world of difference (at least on SVN2703).
'list' only returns items from the current folder.
'tree' returns items from the current folder AND all subfolders.

For example:
If you have the following structure:

Folder 1
--Article A
--Article B
--Folder 1A
----Article 1Aa
----Article 1Ab

fetch(content,list,hash(parent_node_id, <Folder 1>.node_id))}
your resultset will include the objects
Article A
Article B
Folder 1A

fetch(content,tree,hash(parent_node_id, <Folder 1>.node_id))}
your resultset will include the objects
Article A
Article B
Folder 1A
Article 1Aa
Article 1Ab

This tree recursion also applies when you in/exclude certain classes from your fetch:

For example if we exclude folders from the fetch:
fetch(content,tree,hash(parent_node_id, <Folder 1>.node_id, class_filter_type,exclude,class_filter_array,array(1))}
will return a resultset of
Article A
Article B
Article 1Aa
Article 1Ab

Regards,

Tristan

Bruce Morrison

Thursday 14 August 2003 12:53:55 am

"list" is the same as "tree" with a depth of 1. They even use the same underlying function to retrieve the content. The parameters are just more restricted with list.

It makes sense to have both.

Cheers
Bruce
designIT

My Blog: http://www.stuffandcontent.com/
Follow me on twitter: http://twitter.com/brucemorrison
Consolidated eZ Publish Feed : http://friendfeed.com/rooms/ez-publish