Forums / Developer / eZContentObjectTreeNode AttributeFilter

eZContentObjectTreeNode AttributeFilter

Author Message

Ivan Švogor

Monday 07 March 2011 6:58:44 am

Any idea why doesn't work? - AttributeFilter specifcally...

include_once('kernel/classes/ezcontentobjecttreenode.php');

        
        $objects =& eZContentObjectTreeNode::subTreeByNodeID(  array(
            'ClassFilterType' => 'include',
            'ClassFilterArray' => array( 'article' ),
            'SortBy' => array( 'published', false ),
            'AttributeFilter' => array('and',array('article/title','like', '*'))
            ),
            $node_id
        );

this one works.... But this one not (relation_category) is object relation

include_once('kernel/classes/ezcontentobjecttreenode.php');

        
        $objects =& eZContentObjectTreeNode::subTreeByNodeID(  array(
            'ClassFilterType' => 'include',
            'ClassFilterArray' => array( 'article' ),
            'SortBy' => array( 'published', false ),
            'AttributeFilter' => array('and',array('article/relation_category','like', '*'))
            ),
            $node_id
        );

Marko Žmak

Monday 07 March 2011 12:47:43 pm

The code you're using for filtering on object relation attribute should work. I've just tested id on my site and it works (ezP 4.2). It returned all the articles. I used the same code as you did, just with a different class and attribute.

So it seems like there must be something else wrong with your code.

Maybe you misspelled the attribute name?

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

Hubert Farnsworth