/**
  * @param \Doctrine\ORM\Tools\Event\SchemaIndexDefinitionEventArgs $args
  */
 public function onSchemaIndexDefinition(SchemaIndexDefinitionEventArgs $args)
 {
     $index = $args->getTableIndex();
     if (0 === stripos($index['name'], 'spatialidx_')) {
         $args->preventDefault();
     }
 }
 /**
  * Handles the Doctrine schema and overrides the indexes with a fixed length.
  *
  * @param SchemaIndexDefinitionEventArgs $event
  */
 public function onSchemaIndexDefinition(SchemaIndexDefinitionEventArgs $event)
 {
     $connection = $event->getConnection();
     $data = $event->getTableIndex();
     if (!$connection->getDatabasePlatform() instanceof MySqlPlatform || 'PRIMARY' === $data['name']) {
         return;
     }
     $index = $connection->fetchAssoc(sprintf("SHOW INDEX FROM %s WHERE Key_name='%s'", $event->getTable(), $data['name']));
     if (null !== $index['Sub_part']) {
         $columns = [];
         foreach ($data['columns'] as $col) {
             $columns[$col] = sprintf('%s(%s)', $col, $index['Sub_part']);
         }
         $event->setIndex(new Index($data['name'], $columns, $data['unique'], $data['primary'], $data['flags'], $data['options']));
         $event->preventDefault();
     }
 }
 public function onSchemaIndexDefinition(SchemaIndexDefinitionEventArgs $args)
 {
     $index = $args->getTableIndex();
     $spatialIndexes = $this->schemaManager->listSpatialIndexes($args->getTable());
     if (!isset($spatialIndexes[$index['name']])) {
         return;
     }
     $spatialIndex = new Index($index['name'], $index['columns'], $index['unique'], $index['primary'], array_merge($index['flags'], array('SPATIAL')));
     $args->setIndex($spatialIndex)->preventDefault();
 }