ezbinaryfile from ez framework

Author Message

Daniel Guerrier

Tuesday 23 August 2005 2:39:59 pm

How do I access the information of a binary attribute of a content class.

I am using this to get text from a text field

$objects =& eZContentObject::fetchSameClassList($class->attribute( 'id' ));
$objectData =& $objects[0]->dataMap();

$attribute = $objectData['text'];
$attribute->attribute('content');

$attribute = $objectData['file'];
$attribute->attribute('content');

What method would be used to access the binary file download count original file name etc from the ez framework.

$myTest = $attribute->dataType();

returns a ezbinaryfile but I can't seem to get to the actual data.

Thanks

Daniel Guerrier

Tuesday 23 August 2005 7:58:15 pm

Everyone with the answer seems to ignore these question.
So after a lot of wasted hours echoing get_class to get return values and printing out all values in arrays that are not documented as a return value to get the available attributes here is the solution.

$class =& eZContentClass::fetchByIdentifier('contentclassname');
$objects =& eZContentObject::fetchSameClassList($class->attribute( 'id' ));
$objectData =& $objects[0]->dataMap();

			
$attribute = $objectData['file'];
$binaryFiles =& eZBinaryFile::fetch( $attribute->attribute('id') );

echo($binaryFiles[0]->attribute('download_count'));

Also, here are all the available attributes for the binaryfiletype

Key: 0; Value: contentobject_attribute_id
Key: 1; Value: version
Key: 2; Value: filename
Key: 3; Value: original_filename
Key: 4; Value: mime_type
Key: 5; Value: download_count
Key: 6; Value: filesize
Key: 7; Value: filepath
Key: 8; Value: mime_type_category
Key: 9; Value: mime_type_part

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 19:06:52
Script start
Timing: Jan 18 2025 19:06:52
Module start 'layout'
Timing: Jan 18 2025 19:06:52
Module start 'content'
Timing: Jan 18 2025 19:06:53
Module end 'content'
Timing: Jan 18 2025 19:06:53
Script end

Main resources:

Total runtime0.8519 sec
Peak memory usage4,096.0000 KB
Database Queries52

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0058 589.3438152.6250
Module start 'layout' 0.00580.0025 741.968839.4453
Module start 'content' 0.00830.8422 781.4141430.8516
Module end 'content' 0.85050.0013 1,212.26568.1641
Script end 0.8518  1,220.4297 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00370.4341160.0002
Check MTime0.00170.1971160.0001
Mysql Total
Database connection0.00120.143910.0012
Mysqli_queries0.806794.6998520.0155
Looping result0.00050.0548500.0000
Template Total0.810495.120.4052
Template load0.00220.255820.0011
Template processing0.808294.869720.4041
Template load and register function0.00020.023110.0002
states
state_id_array0.00150.171410.0015
state_identifier_array0.00110.134520.0006
Override
Cache load0.00190.2188250.0001
Sytem overhead
Fetch class attribute can translate value0.00080.090410.0008
Fetch class attribute name0.00170.201120.0009
XML
Image XML parsing0.00010.013410.0001
class_abstraction
Instantiating content class attribute0.00000.000820.0000
General
dbfile0.00060.0691100.0001
String conversion0.00000.000740.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
6content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
3content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
2content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 15
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs