コード例 #1
0
 /**
  * @override
  */
 public function loadMetaDataForClass($className, ClassMetadataInfo $metadata)
 {
     // Load the parent, which loads the metadata with usual field attributes
     parent::loadMetaDataForClass($className, $metadata);
     // We add to metadata the info about mootools field attribute
     $element = $this->getElement($className);
     if (isset($element['fields'])) {
         foreach ($element['fields'] as $name => $fieldMapping) {
             $mapping = $metadata->getFieldMapping($name);
             if (isset($fieldMapping['mootools'])) {
                 $mapping['mootools'] = $fieldMapping['mootools'];
             }
             //$metadata->mapField($mapping); // Throws Duplicate Exception, of course ^^
             // So, Hackish way to replace the existing fieldMapping (it's READ-ONLY)
             $metadata->fieldMappings[$name] = $mapping;
         }
     }
 }