get the list of objects

Author Message

Bass The Butcher

Sunday 27 July 2008 4:44:29 am

Hi all,

I need to get a list of objects of particular class and particular owner within PHP code, not template.
For example I need to delete all articles of user with id:12.

Thanks.

Pascal Specht

Monday 28 July 2008 9:19:53 am

Hi,

I would use the fetch function, like this (exemple, get all products):

$list = eZContentObjectTreeNode::subTree( array( 'Depth' => 100,
											 'ClassFilterType' => 'include',
											 'ClassFilterArray' => array('product') ), 2 );

and then loop through the objects looking ofr their creator ID or placement, to find out who they belong to.

Hope this helps,
Cheers,

</Pascal>

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 16:17:21
Script start
Timing: Jan 18 2025 16:17:21
Module start 'layout'
Timing: Jan 18 2025 16:17:21
Module start 'content'
Timing: Jan 18 2025 16:17:23
Module end 'content'
Timing: Jan 18 2025 16:17:23
Script end

Main resources:

Total runtime1.1904 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.0059 587.9063152.6250
Module start 'layout' 0.00590.0034 740.531339.4453
Module start 'content' 0.00921.1795 779.9766493.7266
Module end 'content' 1.18870.0016 1,273.70318.1719
Script end 1.1904  1,281.8750 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00350.2912160.0002
Check MTime0.00140.1162160.0001
Mysql Total
Database connection0.00090.076910.0009
Mysqli_queries1.143196.0234540.0212
Looping result0.00060.0499520.0000
Template Total1.156197.120.5780
Template load0.00190.161820.0010
Template processing1.154196.950920.5771
Template load and register function0.00030.021910.0003
states
state_id_array0.00090.076610.0009
state_identifier_array0.00180.148320.0009
Override
Cache load0.00150.1295160.0001
Sytem overhead
Fetch class attribute can translate value0.00080.070120.0004
Fetch class attribute name0.00110.093830.0004
XML
Image XML parsing0.00060.049820.0003
class_abstraction
Instantiating content class attribute0.00000.000730.0000
General
dbfile0.00080.0694160.0001
String conversion0.00000.000840.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
5content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
2content/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
1content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 13
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs