Tuesday 15 June 2010 5:20:10 am
This method is invoked the attributes names (within eZ Find) to Solr field names. For instance, when building a facet using the following syntax : 'mycontentclass/mydateattribute', this method receives 'mydateattribute' and should return 'attr_mydateattribute_dt'. Here is how we are going to implement the body of this method :
const DEFAULT_SUBATTRIBUTE_TYPE = 'date'; public static function getFieldName( eZContentClassAttribute $classAttribute, $subAttribute = null, $context = 'search' ) { switch ( $classAttribute->attribute( 'data_type_string' ) ) { case 'ezdate' : { if ( $subAttribute and $subAttribute !== '' ) { // A subattribute was passed return parent::generateSubattributeFieldName( $classAttribute, $subAttribute, self::DEFAULT_SUBATTRIBUTE_TYPE ); } else { // return the default field name here. return parent::generateAttributeFieldName( $classAttribute, self::getClassAttributeType( $classAttribute, null, $context ) ); } } break; default: {} break; } }