Data retrieval (edited) - Second Try

Author Message

Daniel Guerrier

Monday 22 August 2005 4:49:46 pm

Can someone give me a quick explanation of how data retrieval works using the ez framework.

I have a content class called myfile with a textfield named title and a file attribute name file.
I have two instances of this content class with node ids of 120 and 121.

When I use this code to fetch all instances I end up with a node id of 512. How do I retrieve the actual content class instances and access the data in the attributes?

$class =& eZContentClass::fetchByIdentifier('myfile');
if(is_object($class))
{
	$objects =& eZContentObject::fetchSameClassList($class->attribute( 'id' ));
	echo($objects[0]->attribute('id'));
}

I was under the assumption that ClassList fetch returned the individual content class instances.

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 22:20:18
Script start
Timing: Jan 18 2025 22:20:18
Module start 'layout'
Timing: Jan 18 2025 22:20:18
Module start 'content'
Timing: Jan 18 2025 22:20:18
Module end 'content'
Timing: Jan 18 2025 22:20:18
Script end

Main resources:

Total runtime0.0414 sec
Peak memory usage2,048.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0214 587.9453152.6250
Module start 'layout' 0.02140.0044 740.570339.4453
Module start 'content' 0.02580.0117 780.015685.3516
Module end 'content' 0.03750.0038 865.367230.3047
Script end 0.0413  895.6719 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.005212.4454140.0004
Check MTime0.00184.3201140.0001
Mysql Total
Database connection0.006515.776610.0065
Mysqli_queries0.006515.732830.0022
Looping result0.00000.067410.0000
Template Total0.00245.810.0024
Template load0.00153.679110.0015
Template processing0.00092.101610.0009
Override
Cache load0.00112.572710.0011
General
dbfile0.00030.844980.0000
String conversion0.00000.030540.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0002 secs