getGeographySpatialColumnInfo() публичный Метод

public getGeographySpatialColumnInfo ( $table, $column )
 public function testGetGeographySpatialColumnInfo()
 {
     $schemaManager = new SchemaManager($this->_getConnection());
     $this->assertNull($schemaManager->getGeographySpatialColumnInfo('foo.points', 'text'));
     $expected = array('type' => 'GEOMETRY', 'srid' => 4326);
     $this->assertEquals($expected, $schemaManager->getGeographySpatialColumnInfo('points', 'geography'));
     $expected = array('type' => 'POINT', 'srid' => 4326);
     $this->assertEquals($expected, $schemaManager->getGeographySpatialColumnInfo('points', 'point_geography_2d'));
     $expected = array('type' => 'POINT', 'srid' => 4326);
     $this->assertEquals($expected, $schemaManager->getGeographySpatialColumnInfo('points', 'point_geography_2d_srid'));
 }
 public function onSchemaColumnDefinition(SchemaColumnDefinitionEventArgs $args)
 {
     $tableColumn = array_change_key_case($args->getTableColumn(), CASE_LOWER);
     $table = $args->getTable();
     $info = null;
     if ('geometry' === $tableColumn['type']) {
         $info = $this->schemaManager->getGeometrySpatialColumnInfo($table, $tableColumn['field']);
     } elseif ('geography' === $tableColumn['type']) {
         $info = $this->schemaManager->getGeographySpatialColumnInfo($table, $tableColumn['field']);
     }
     if (!$info) {
         return;
     }
     $default = null;
     if (isset($tableColumn['default']) && 'NULL::geometry' !== $tableColumn['default'] && 'NULL::geography' !== $tableColumn['default']) {
         $default = $tableColumn['default'];
     }
     $options = array('notnull' => (bool) $tableColumn['isnotnull'], 'default' => $default, 'primary' => (bool) ($tableColumn['pri'] == 't'), 'comment' => isset($tableColumn['comment']) ? $tableColumn['comment'] : null);
     $column = new Column($tableColumn['field'], PostGISType::getType($tableColumn['type']), $options);
     $column->setCustomSchemaOption('geometry_type', $info['type'])->setCustomSchemaOption('srid', $info['srid']);
     $args->setColumn($column)->preventDefault();
 }
Пример #3
0
 public function testGetGeographySpatialColumnInfoWithReservedWords()
 {
     $schemaManager = new SchemaManager($this->_getConnection());
     $expected = array('type' => 'GEOMETRY', 'srid' => 4326);
     $this->assertEquals($expected, $schemaManager->getGeographySpatialColumnInfo('"user"', '"primary"'));
 }