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

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 18 2025 02:07:11
Script start
Timing: Jan 18 2025 02:07:11
Module start 'layout'
Timing: Jan 18 2025 02:07:11
Module start 'content'
Timing: Jan 18 2025 02:07:12
Module end 'content'
Timing: Jan 18 2025 02:07:12
Script end

Main resources:

Total runtime1.0761 sec
Peak memory usage4,096.0000 KB
Database Queries54

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0056 588.0469152.6406
Module start 'layout' 0.00560.0026 740.687539.4844
Module start 'content' 0.00821.0662 780.1719525.7891
Module end 'content' 1.07440.0016 1,305.96098.2813
Script end 1.0760  1,314.2422 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00310.2908160.0002
Check MTime0.00140.1286160.0001
Mysql Total
Database connection0.00100.094810.0010
Mysqli_queries1.026795.4067540.0190
Looping result0.00050.0482520.0000
Template Total1.045597.220.5228
Template load0.00250.235120.0013
Template processing1.043096.923220.5215
Template load and register function0.00010.013810.0001
states
state_id_array0.00060.052210.0006
state_identifier_array0.00190.178420.0010
Override
Cache load0.00210.1957210.0001
Sytem overhead
Fetch class attribute can translate value0.00130.123520.0007
Fetch class attribute name0.00110.102630.0004
XML
Image XML parsing0.00070.068920.0004
class_abstraction
Instantiating content class attribute0.00000.000630.0000
General
dbfile0.00360.3304170.0002
String conversion0.00000.000440.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
2content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
3content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 9
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs