Jsor\Doctrine\PostGIS\Event\DBALSchemaEventSubscriber::onSchemaAlterTableChangeColumn PHP Method

onSchemaAlterTableChangeColumn() public method

public onSchemaAlterTableChangeColumn ( Doctrine\DBAL\Event\SchemaAlterTableChangeColumnEventArgs $args )
$args Doctrine\DBAL\Event\SchemaAlterTableChangeColumnEventArgs
    public function onSchemaAlterTableChangeColumn(SchemaAlterTableChangeColumnEventArgs $args)
    {
        $columnDiff = $args->getColumnDiff();
        $column = $columnDiff->column;
        if (!$this->isSpatialColumnType($column)) {
            return;
        }
        $diff = $args->getTableDiff();
        $table = new Identifier(false !== $diff->newName ? $diff->newName : $diff->name);
        if ($columnDiff->hasChanged('type')) {
            throw new \RuntimeException('The type of a spatial column cannot be changed (Requested changing type from "' . $columnDiff->fromColumn->getType()->getName() . '" to "' . $column->getType()->getName() . '" for column "' . $column->getName() . '" in table "' . $table->getName() . '")');
        }
        if ($columnDiff->hasChanged('geometry_type')) {
            throw new \RuntimeException('The geometry_type of a spatial column cannot be changed (Requested changing type from "' . strtoupper($columnDiff->fromColumn->getCustomSchemaOption('geometry_type')) . '" to "' . strtoupper($column->getCustomSchemaOption('geometry_type')) . '" for column "' . $column->getName() . '" in table "' . $table->getName() . '")');
        }
        if ($columnDiff->hasChanged('srid')) {
            $args->addSql(sprintf("SELECT UpdateGeometrySRID('%s', '%s', %d)", $table->getName(), $column->getName(), $column->getCustomSchemaOption('srid')));
        }
    }