Jsor\Doctrine\PostGIS\Schema\SchemaManager::getGeometrySpatialColumnInfo PHP Method

getGeometrySpatialColumnInfo() public method

public getGeometrySpatialColumnInfo ( $table, $column )
    public function getGeometrySpatialColumnInfo($table, $column)
    {
        if (false !== strpos($table, '.')) {
            list(, $table) = explode('.', $table);
        }
        $sql = 'SELECT coord_dimension, srid, type
                FROM geometry_columns
                WHERE f_table_name = ?
                AND f_geometry_column = ?';
        $row = $this->connection->fetchAssoc($sql, array($this->trimQuotes($table), $this->trimQuotes($column)));
        if (!$row) {
            return null;
        }
        return $this->buildSpatialColumnInfo($row);
    }

Usage Example

 public function testGetGeometrySpatialColumnInfo()
 {
     $schemaManager = new SchemaManager($this->_getConnection());
     $this->assertNull($schemaManager->getGeometrySpatialColumnInfo('foo.points', 'text'));
     $expected = array('type' => 'GEOMETRY', 'srid' => 0);
     $this->assertEquals($expected, $schemaManager->getGeometrySpatialColumnInfo('points', 'geometry'));
     $expected = array('type' => 'POINT', 'srid' => 0);
     $this->assertEquals($expected, $schemaManager->getGeometrySpatialColumnInfo('points', 'point'));
     $expected = array('type' => 'POINT', 'srid' => 3785);
     $this->assertEquals($expected, $schemaManager->getGeometrySpatialColumnInfo('points', 'point_2d'));
     $expected = array('type' => 'POINTZ', 'srid' => 3785);
     $this->assertEquals($expected, $schemaManager->getGeometrySpatialColumnInfo('points', 'point_3dz'));
     $expected = array('type' => 'POINTM', 'srid' => 3785);
     $this->assertEquals($expected, $schemaManager->getGeometrySpatialColumnInfo('points', 'point_3dm'));
     $expected = array('type' => 'POINTZM', 'srid' => 3785);
     $this->assertEquals($expected, $schemaManager->getGeometrySpatialColumnInfo('points', 'point_4d'));
     $expected = array('type' => 'POINT', 'srid' => 3785);
     $this->assertEquals($expected, $schemaManager->getGeometrySpatialColumnInfo('points', 'point_2d_nullable'));
     $expected = array('type' => 'POINT', 'srid' => 0);
     $this->assertEquals($expected, $schemaManager->getGeometrySpatialColumnInfo('points', 'point_2d_nosrid'));
 }
All Usage Examples Of Jsor\Doctrine\PostGIS\Schema\SchemaManager::getGeometrySpatialColumnInfo