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.