Monday 18 October 2010 10:56:04 am
Hi Heath, That's a lead I'm following... For now I'm trying to create a datatype (only usefull on my class) that define only the method "objectAttributeContent" that receive the attribute object as parameter. From that I can get infos on it. But it fits only the class that contains this kind of datatype and that could be a problem in the future
class MyType extends eZDataType{
/**
* @param eZContentObjectAttribute $contentObjectAttribute
*/
public function objectAttributeContent($contentObjectAttribute){
/**
* @var eZContentObject
*/
$object = $contentObjectAttribute->object();
if(!$object->ClassIdentifier == 'myclass'){
return;
}
return setValueWithbusinessLogic($object);
}
function setValueWithbusinessLogic($object){
//Mock of what could be done
$value = 100 + $object->attribute('otherAttribute');
//Add DB, ezIni,... accesses
return $value;
}
} Am I right in the method? It's something I could need to do this frequently. Could we think to extend (or hack) the actual ezContentObject class to implement a nice way to read INI files in combinaison with a generix datatype or extension method? In fact, a nice way to create custom derived attribute to avoid tight coupling between the class definition and the attribute! Anyway, thanks for the help ;-) Cheers Antoine
|