Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The geometry_type of a spatial column cannot be changed #5

Closed
ghost opened this issue Jul 28, 2015 · 1 comment
Closed

The geometry_type of a spatial column cannot be changed #5

ghost opened this issue Jul 28, 2015 · 1 comment

Comments

@ghost
Copy link

ghost commented Jul 28, 2015

I use SF2.7 , and when try to make
app/console doctrine:migrations:diff and got such exception
i debug these code and have

class Doctrine\DBAL\Schema\ColumnDiff#1308 (4) {
public $oldColumnName =>
string(14) "location_point"
public $column =>
class Doctrine\DBAL\Schema\Column#1223 (16) {
protected $_type =>
class Jsor\Doctrine\PostGIS\Types\GeographyType#529 (0) {
}
protected $_length =>
NULL
protected $_precision =>
int(0)
protected $_scale =>
int(0)
protected $_unsigned =>
bool(false)
protected $_fixed =>
bool(false)
protected $_notnull =>
bool(true)
protected $_default =>
NULL
protected $_autoincrement =>
bool(false)
protected $_platformOptions =>
array(1) {
'version' =>
bool(false)
}
protected $_columnDefinition =>
NULL
protected $_comment =>
NULL
protected $_customSchemaOptions =>
array(4) {
'spatial_type' =>
string(5) "POINT"
'spatial_srid' =>
int(4326)
'geometry_type' =>
string(8) "GEOMETRY"
'srid' =>
int(4326)
}
protected $_name =>
string(14) "location_point"
protected $_namespace =>
NULL
protected $_quoted =>
bool(false)
}
public $changedProperties =>
array(3) {
[0] =>
string(13) "geometry_type"
[1] =>
string(12) "spatial_type"
[2] =>
string(12) "spatial_srid"
}
public $fromColumn =>
class Doctrine\DBAL\Schema\Column#792 (16) {
protected $_type =>
class Jsor\Doctrine\PostGIS\Types\GeographyType#529 (0) {
}
protected $_length =>
NULL
protected $_precision =>
int(10)
protected $_scale =>
int(0)
protected $_unsigned =>
bool(false)
protected $_fixed =>
bool(false)
protected $_notnull =>
bool(true)
protected $_default =>
NULL
protected $_autoincrement =>
bool(false)
protected $_platformOptions =>
array(0) {
}
protected $_columnDefinition =>
NULL
protected $_comment =>
NULL
protected $_customSchemaOptions =>
array(2) {
'geometry_type' =>
string(5) "POINT"
'srid' =>
int(4326)
}
protected $_name =>
string(14) "location_point"
protected $_namespace =>
NULL
protected $_quoted =>
bool(false)
}
}

and my entity

/**

  • @Orm\Embeddable
    /
    class Coordinates
    {
    /
    *
    • @var string
    • @Orm\Column(type="geography", options={"spatial_type"="POINT", "spatial_srid"=4326})
      */
      private $point;

Why i receive such exception and how to fix it?

@jsor
Copy link
Owner

jsor commented Jul 28, 2015

Unfortunately, spatial column types can't be changed because there is no way to cast data from one geometry to another. If you already have a spatial column in your database, you need to change the type and convert the data manually.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant