Share » Forums » Developer » Fetching and sorting in PHP, using...

Fetching and sorting in PHP, using extended attribute filter

Fetching and sorting in PHP, using extended attribute filter

Thursday 13 May 2010 8:08:55 am - 2 replies

Modified on Thursday 13 May 2010 8:15:49 am by Igor Vrdoljak

Author Message

Damien Pobel

Thursday 13 May 2010 2:10:20 pm

Hi Igor

The equivalent of the template hash operator is the array PHP function. (the hash PHP function exists but it's not what you expect here). So I guess the correct code is the following (depending on the extended attribute filter you use) :

$nodes = eZContentObjectTreeNode::subTreeByNodeID( array( 'MainNodeOnly' => true,
                                                          'ClassFilterType' => 'include',
                                                          'ClassFilterArray' => array( $class_identifier ),
                                                          'SortBy' => array( 'my_sql_var', true ),
                                                          'ExtendedAttributeFilter' => array( 'id' => 'myExtFilter',
                                                                                              'params', array( 'var_1' => $var_1 ) ) ),
                                                   $parent_node_id );

Cheers !

Damien
Planet eZ Publish.fr : http://www.planet-ezpublish.fr
Certification : http://auth.ez.no/certification/verify/372448
Publications about eZ Publish : http://pwet.fr/tags/keywords/weblog/ez_publish

Igor Vrdoljak

Saturday 15 May 2010 2:16:26 am

Hi Damien,

Thanx for the tip, it was the case of using hash arrays in PHP.

Params attribute also has to be in a hash array, so the final working snippet is:

eZContentObjectTreeNode::subTreeByNodeID( array('MainNodeOnly' => true,
  'ClassFilterType' => 'include',
  'ClassFilterArray' => array( $class_identifier ),
  'SortBy' => array( 'my_sql_var', true ),
  'ExtendedAttributeFilter' => array( 'id' => 'myExtFilter',
    'params' => array( 'var_1' => $var_1 ) ) ),
  $parent_node_id );

http://www.netgen.hr/eng
http://twitter.com/ivrdoljak

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu