Well, the main_node_only parameter should do what you are willing to do. What do you exactly mean by : "So, the main_node_only parameter remove too much nodes inside the subtree."
Cheers,
--
Nicolas Pastorino
Director Community - eZ
Member of the Community Project Board
The main_node_only parameter only retrieve the main location (or main node, as you want).The main_node_only parameter doesn't retrieve the content objects which the main node is outside the sub-tree.
I need to fetch all content objects in the sub-tree. But without the main_node_only parameter the query probably fetch same content object many times (cause of different locations in the sub-tree).
I'd go for a custom fetch function here, overriding the content/list one (to preserve the many useful parameters ), going as follows :
Run the content/list fetch function from PHP ( use the magic eZFunctionHandler::execute(...) ) with 'as_object' [1] set to false --> performances performances.
Loop over the results, building an intermediate associative array, with contentobject IDs as keys. Will automatically filter out duplicates object IDs by overriding the keys.
Return the array values, or replace them by fetched eZContentObjectTreeNode objects, on a one-by-one basis.