/**
  * Builds mappings for a single type.
  *
  * @param TypeConfig $typeConfig
  * @return array
  */
 public function buildTypeMapping(TypeConfig $typeConfig)
 {
     $mapping = array_merge($typeConfig->getMapping(), array());
     if ($typeConfig->getIndexAnalyzer()) {
         $mapping['index_analyzer'] = $typeConfig->getIndexAnalyzer();
     }
     if ($typeConfig->getSearchAnalyzer()) {
         $mapping['search_analyzer'] = $typeConfig->getSearchAnalyzer();
     }
     if (isset($mapping['dynamic_templates']) and empty($mapping['dynamic_templates'])) {
         unset($mapping['dynamic_templates']);
     }
     $this->fixProperties($mapping['properties']);
     if (!$mapping['properties']) {
         unset($mapping['properties']);
     }
     if ($typeConfig->getModel()) {
         $mapping['_meta']['model'] = $typeConfig->getModel();
     }
     if (!$mapping) {
         // Empty mapping, we want it encoded as a {} instead of a []
         $mapping = new \stdClass();
     }
     return $mapping;
 }
 /**
  * Builds mappings for a single type.
  *
  * @param TypeConfig $typeConfig
  *
  * @return array
  */
 public function buildTypeMapping(TypeConfig $typeConfig)
 {
     $mapping = $typeConfig->getMapping();
     if (null !== $typeConfig->getDynamicDateFormats()) {
         $mapping['dynamic_date_formats'] = $typeConfig->getDynamicDateFormats();
     }
     if (null !== $typeConfig->getDateDetection()) {
         $mapping['date_detection'] = $typeConfig->getDateDetection();
     }
     if (null !== $typeConfig->getNumericDetection()) {
         $mapping['numeric_detection'] = $typeConfig->getNumericDetection();
     }
     if ($typeConfig->getIndexAnalyzer()) {
         $mapping['index_analyzer'] = $typeConfig->getIndexAnalyzer();
     }
     if ($typeConfig->getSearchAnalyzer()) {
         $mapping['search_analyzer'] = $typeConfig->getSearchAnalyzer();
     }
     if (isset($mapping['dynamic_templates']) and empty($mapping['dynamic_templates'])) {
         unset($mapping['dynamic_templates']);
     }
     $this->fixProperties($mapping['properties']);
     if (!$mapping['properties']) {
         unset($mapping['properties']);
     }
     if ($typeConfig->getModel()) {
         $mapping['_meta']['model'] = $typeConfig->getModel();
     }
     if (empty($mapping)) {
         // Empty mapping, we want it encoded as a {} instead of a []
         $mapping = new \stdClass();
     }
     return $mapping;
 }