public static function getAllTypes()
 {
     self::init();
     if (count(self::$types) > 0) {
         return self::$types;
     }
     $sm = new SectionManager(Symphony::Engine());
     $get_mappings = self::getIndex()->request('_mapping', Elastica_Request::GET, array());
     $all_mappings = $get_mappings->getData();
     self::$mappings = reset($all_mappings);
     $types = array();
     foreach ($sm->fetch() as $section) {
         $elasticsearch_mapping_file = sprintf('%s/elasticsearch/mappings/%s.json', WORKSPACE, preg_replace('/-/', '_', $section->get('handle')));
         $symphony_mapping_file = sprintf('%s/elasticsearch/mappings/%s.php', WORKSPACE, preg_replace('/-/', '_', $section->get('handle')));
         // no mapping, no valid type
         if (!file_exists($elasticsearch_mapping_file)) {
             continue;
         }
         require_once $symphony_mapping_file;
         $symphony_mapping_classname = sprintf('elasticsearch_%s', preg_replace('/-/', '_', $section->get('handle')));
         $symphony_mapping_class = new $symphony_mapping_classname();
         $elasticsearch_mapping_json = file_get_contents($elasticsearch_mapping_file);
         $elasticsearch_mapping = json_decode($elasticsearch_mapping_json, FALSE);
         $mapped_fields = $elasticsearch_mapping->{$section->get('handle')}->properties;
         // invalid JSON
         if (!$mapped_fields) {
             throw new Exception('Invalid mapping JSON for ' . $section->get('handle'));
         }
         $fields = array();
         foreach ($mapped_fields as $field => $mapping) {
             $fields[] = $field;
         }
         $type = self::getIndex()->getType($section->get('handle'));
         if (!isset(self::$mappings[$section->get('handle')])) {
             $type = NULL;
         }
         $types[$section->get('handle')] = (object) array('section' => $section, 'fields' => $fields, 'type' => $type, 'mapping_json' => $elasticsearch_mapping_json, 'mapping_class' => $symphony_mapping_class);
     }
     self::$types = $types;
     return $types;
 }