/** * @param \Doctrine\ORM\Tools\Event\SchemaCreateTableColumnEventArgs $args */ public function onSchemaCreateTableColumn(SchemaCreateTableColumnEventArgs $args) { $column = $args->getColumn(); if (!$column->getType() instanceof \Doctrine\Spatial\DBAL\Types\Type) { return; } $platform = $args->getPlatform(); $args->preventDefault()->addSql($this->getAddColumnSQL($args->getTable()->getQuotedName($platform), $column->getQuotedName($platform), $column)); }
/** * @param \Doctrine\ORM\Tools\Event\SchemaCreateTableColumnEventArgs $args */ public function onSchemaCreateTableColumn(SchemaCreateTableColumnEventArgs $args) { $column = $args->getColumn(); if (!$column->getType() instanceof \Doctrine\Spatial\DBAL\Types\Type) { return; } if ($column->hasCustomSchemaOption('spatial_index') && $column->getCustomSchemaOption('spatial_index')) { $platform = $args->getPlatform(); $indexName = $this->generateIndexName($args->getTable()->getName(), $column->getName()); $args->addSql(sprintf("CREATE SPATIAL INDEX %s ON %s (%s)", $indexName, $args->getTable()->getQuotedName($platform), $column->getQuotedName($platform))); } }