Details
-
Bug
-
Resolution: Won't Do
-
Major
-
None
-
None
-
None
Description
I think I spotted a different approach for two of the collecAllChildren methods in the info.magnolia.cms.util.ContentUtil class. The methods collect nodes recursively.
1. collectAllChildren(List nodes, Content node, ContentFilter filter)
In this method the first level of children is collected with the filter. For the next level of children not only the nodes that match the filter are taken into account, but the children of ALL nodes of the first level. So children that match the filter, but who's parents do not, are indeed found.
2. collectAllChildren(List nodes, Content node, ItemType[] types)
In this method however, only children that have parents that match one of the ItemTypes in the array are found. For example: if I am looking for all nodes of type B and C, but when some of them have a parent of type A, they will not be found.
This seems inconsistent to me, and I think the first way matches the expected functionality the best. Maybe this method should be deprecated, saying it does not work well, and create a new method, for example collectAllChildrenByItemTypes which does the better job. This way existing code will still work as expected with the deprecated method, and you are not suddenly confronted with different behaviour.