Forums / Developer / Attribute Filter by related objects in php

Attribute Filter by related objects in php

Author Message

Łukasz Kęska

Tuesday 12 July 2011 12:28:58 am

Hi all

I have a problem creating fetch in php script using AttributeFilter on related objects list. I saw many examples how to do it in templates, so I thought it should be obvious:

$params = array(           
                'AttributeFilter'  => array(array('myclass/myattr','=',$objectid)),
                'Depth'             => 1,
                'ClassFilterType'   => 'include',
                'ClassFilterArray'  => array( 'myclass' ),
                'limit' => 1
            );

$list = eZContentObjectTreeNode::subTreeByNodeID( $params, $nodeid );

Where myclass is a class identificator, myattr is an object relation list attribute identificator and $objectid is a contentobjectID of an object chosen in object relation.

It just doesn't work. Please advice :-)

Lucas

 

Peter Keung

Tuesday 12 July 2011 12:55:00 pm

For object relation list, you have to use an extended attribute filter. Here is a recommendation for an existing one:

http://projects.ez.no/objectrelationfilter

http://www.mugo.ca
Mugo Web, eZ Partner in Vancouver, Canada