<!-- 
RSS generated by JIRA (5.2.7#850-sha1:b2af0c8dc8537b36121c6a579fabbdf79fc919e5) at Wed May 22 10:03:12 UTC 2013

It is possible to restrict the fields that are returned in this document by specifying the 'field' parameter in your request.
For example, to request only the issue key and summary add field=key&field=summary to the URL of your request.
For example:
http://www.doctrine-project.org/jira/si/jira.issueviews:issue-xml/DBAL-337/DBAL-337.xml?field=key&field=summary
-->
<rss version="0.92" >
<channel>
    <title>Doctrine Project</title>
    <link>http://www.doctrine-project.org/jira</link>
    <description>This file is an XML representation of an issue</description>
    <language>en-us</language>    <build-info>
        <version>5.2.7</version>
        <build-number>850</build-number>
        <build-date>21-02-2013</build-date>
    </build-info>

<item>
            <title>[DBAL-337] Column types are truncated when mapping PostGIS types</title>
                <link>http://www.doctrine-project.org/jira/browse/DBAL-337</link>
                <project id="10040" key="DBAL">Doctrine DBAL</project>
                        <description>&lt;p&gt;When performing a doctrine schema update with Symfony2 (&apos;php app/console doctrine:schema:update --force --verbose&apos;) using a custom PostGIS type mapping, column type descriptions are truncated.&lt;/p&gt;


&lt;p&gt;How to reproduce:&lt;/p&gt;

&lt;p&gt;1) add a custom &apos;point&apos; type to Doctrine&apos;s type mapping&lt;/p&gt;

&lt;div class=&quot;code panel&quot; style=&quot;border-style: solid;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeHeader panelHeader&quot; style=&quot;border-bottom-width: 1px;border-bottom-style: solid;&quot;&gt;&lt;b&gt;in a controller&apos;s boot method&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;
$em = $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;container-&amp;gt;get(&apos;doctrine.orm.default_entity_manager&apos;);
$conn = $em-&amp;gt;getConnection();
&lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (!Type::hasType(&apos;point&apos;)) {
  Type::addType(&apos;point&apos;, &apos;Demo\GeoBundle\Lib\Type\PointType&apos;);
  $conn-&amp;gt;getDatabasePlatform()-&amp;gt;registerDoctrineTypeMapping(&apos;point&apos;, &apos;point&apos;);
}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;div class=&quot;code panel&quot; style=&quot;border-style: solid;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeHeader panelHeader&quot; style=&quot;border-bottom-width: 1px;border-bottom-style: solid;&quot;&gt;&lt;b&gt;PointType.php&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;
&amp;lt;?php

namespace Demo\GeoBundle\Lib\Type;

use Demo\GeoBundle\Lib\Point;

use Doctrine\DBAL\Types\Type; 
use Doctrine\DBAL\Platforms\AbstractPlatform;

class PointType &lt;span class=&quot;code-keyword&quot;&gt;extends&lt;/span&gt; Type {

  &lt;span class=&quot;code-keyword&quot;&gt;const&lt;/span&gt; POINT = &apos;point&apos;;

  /**
   *
   * @param array $fieldDeclaration
   * @param AbstractPlatform $platform
   * @&lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; string 
   */
  &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function getSqlDeclaration(array $fieldDeclaration, AbstractPlatform $platform)
  {
    &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; &apos;geography(POINT,&apos;.Point::$SRID.&apos;)&apos;;
  }

  /**
   *
   * @param type $value
   * @param AbstractPlatform $platform
   * @&lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; Point 
   */
  &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function convertToPHPValue($value, AbstractPlatform $platform)
  {
    &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; Point::fromGeoJson($value);
  }

  &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function getName()
  {
    &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; self::POINT;
    &lt;span class=&quot;code-comment&quot;&gt;//&lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; &apos;geography(POINT,&apos;.Point::$SRID.&apos;)&apos;;
&lt;/span&gt;  }

  &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function convertToDatabaseValue($value, AbstractPlatform $platform)
  {
    &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; $value-&amp;gt;toWKT();
  }

  &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function canRequireSQLConversion()
  {
    &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;;
  }

  &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function convertToPHPValueSQL($sqlExpr, $platform)
  {
    &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; &apos;ST_AsGeoJSON(&apos;.$sqlExpr.&apos;) &apos;;
  }

  &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function convertToDatabaseValueSQL($sqlExpr, AbstractPlatform $platform)
  {
    &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; $sqlExpr;
  }

}

?&amp;gt;
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;div class=&quot;code panel&quot; style=&quot;border-style: solid;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeHeader panelHeader&quot; style=&quot;border-bottom-width: 1px;border-bottom-style: solid;&quot;&gt;&lt;b&gt;Point.php&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;
&amp;lt;?php

namespace Demo\GeoBundle\Lib;

use Demo\GeoBundle\Lib\GeoException;

class Point {
  &lt;span class=&quot;code-keyword&quot;&gt;private&lt;/span&gt; $lat;
  &lt;span class=&quot;code-keyword&quot;&gt;private&lt;/span&gt; $lon;
  &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;static&lt;/span&gt; $SRID = &apos;4326&apos;;

  &lt;span class=&quot;code-keyword&quot;&gt;private&lt;/span&gt; function __construct($lon, $lat) {
    $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;lat = $lat;
    $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;lon = $lon;
  }
  
  &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function setLongitude($lon) {
    $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;lon = $lon;
  }
  
  &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function getLongitude() {
    &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;lon;
  }

  &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function setLatitude($lat) {
    $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;lat = $lat;
  }

  &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function getLatitude() {
    &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;lat;
  }

  &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function toGeoJson(){
    $array = array(&lt;span class=&quot;code-quote&quot;&gt;&quot;type&quot;&lt;/span&gt; =&amp;gt; &lt;span class=&quot;code-quote&quot;&gt;&quot;Point&quot;&lt;/span&gt;, &lt;span class=&quot;code-quote&quot;&gt;&quot;coordinates&quot;&lt;/span&gt; =&amp;gt; array ($&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;lon, $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;lat));
    &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; \json_encode($array);
  }

  /**
   *
   * @&lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; string 
   */
  &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function toWKT() {
    &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; &apos;SRID=&apos;.self::$SRID.&apos;;POINT(&apos;.$&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;lon.&apos; &apos;.$&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;lat.&apos;)&apos;;
  }

  /**
   *
   * @param string $geojson
   * @&lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; Point 
   */
  &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;static&lt;/span&gt; function fromGeoJson($geojson) 
  {
    $a = json_decode($geojson);
    &lt;span class=&quot;code-comment&quot;&gt;//check &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; the geojson string is correct
&lt;/span&gt;    &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; ($a == &lt;span class=&quot;code-keyword&quot;&gt;null&lt;/span&gt; or !isset($a-&amp;gt;type) or !isset($a-&amp;gt;coordinates)){
      &lt;span class=&quot;code-keyword&quot;&gt;throw&lt;/span&gt; GeoException::badJsonString();
    }

    &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; ($a-&amp;gt;type != &lt;span class=&quot;code-quote&quot;&gt;&quot;Point&quot;&lt;/span&gt;){
      &lt;span class=&quot;code-keyword&quot;&gt;throw&lt;/span&gt; GeoException::badGeoType();
    } &lt;span class=&quot;code-keyword&quot;&gt;else&lt;/span&gt; {
      $lon = $a-&amp;gt;coordinates[0];
      $lat = $a-&amp;gt;coordinates[1];
      &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; Point::fromLonLat($lon, $lat);
    }

  }
  
  /**
   *
   * @&lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; string
   */
  &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function __toString() {
    &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;lon . &apos; &apos; . $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;lat;
  }

  /**
   *
   * @&lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; array
   */
  &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function toArray() {
    &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; array($&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;lon, $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;lat);
  }

  &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;static&lt;/span&gt; function fromLonLat($lon, $lat)
  {
    &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (($lon &amp;gt; -180.0 &amp;amp;&amp;amp; $lon &amp;lt; 180.0) &amp;amp;&amp;amp; ($lat &amp;gt; -90.0 &amp;amp;&amp;amp; $lat &amp;lt; 90.0))
    {
      &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; Point($lon, $lat);
    } &lt;span class=&quot;code-keyword&quot;&gt;else&lt;/span&gt; {
      &lt;span class=&quot;code-keyword&quot;&gt;throw&lt;/span&gt; GeoException::badCoordinates($lon, $lat);
    }
  }
}

?&amp;gt;
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;div class=&quot;code panel&quot; style=&quot;border-style: solid;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeHeader panelHeader&quot; style=&quot;border-bottom-width: 1px;border-bottom-style: solid;&quot;&gt;&lt;b&gt;GeoException.php&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;
&amp;lt;?php

namespace Demo\GeoBundle\Lib;

class GeoException &lt;span class=&quot;code-keyword&quot;&gt;extends&lt;/span&gt; \RuntimeException
{
    &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function __construct($message = &lt;span class=&quot;code-keyword&quot;&gt;null&lt;/span&gt;, \Exception $previous = &lt;span class=&quot;code-keyword&quot;&gt;null&lt;/span&gt;, $code = 0)
    {
        parent::__construct($message, $code, $previous);
    }

    &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;static&lt;/span&gt; function badJSonString()
    {
      &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; GeoException(&lt;span class=&quot;code-quote&quot;&gt;&quot;Bad JSon string&quot;&lt;/span&gt;);
    }

    &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;static&lt;/span&gt; function badGeoType()
    {
      &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; GeoException(&lt;span class=&quot;code-quote&quot;&gt;&quot;Bad geo type&quot;&lt;/span&gt;);
    }

    &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;static&lt;/span&gt; function badCoordinates($lon, $lat)
    {
      &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; GeoException(&lt;span class=&quot;code-quote&quot;&gt;&quot;Bad coordinates: &quot;&lt;/span&gt; . $lon . &lt;span class=&quot;code-quote&quot;&gt;&quot; &quot;&lt;/span&gt; . $lat);
    }
}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;


&lt;p&gt;2) with Symfony2, create a simple entity using the Point type:&lt;/p&gt;

&lt;div class=&quot;code panel&quot; style=&quot;border-style: solid;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeHeader panelHeader&quot; style=&quot;border-bottom-width: 1px;border-bottom-style: solid;&quot;&gt;&lt;b&gt;TestPoint.php&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;
&amp;lt;?php

namespace Demo\TestBundle\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
 * @ORM\Entity
 * @ORM\Table(name=&lt;span class=&quot;code-quote&quot;&gt;&quot;test_points&quot;&lt;/span&gt;)
 */
class TestPoint
{
  /**
   * @ORM\Id
   * @ORM\Column(type=&lt;span class=&quot;code-quote&quot;&gt;&quot;integer&quot;&lt;/span&gt;)
   * @ORM\GeneratedValue(strategy=&lt;span class=&quot;code-quote&quot;&gt;&quot;AUTO&quot;&lt;/span&gt;)
   */
  &lt;span class=&quot;code-keyword&quot;&gt;protected&lt;/span&gt; $id;

  /**
   * @ORM\Column(type=&lt;span class=&quot;code-quote&quot;&gt;&quot;point&quot;&lt;/span&gt;)
   */
  &lt;span class=&quot;code-keyword&quot;&gt;protected&lt;/span&gt; $coordinates;

  /**
   * Get id
   *
   * @&lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; integer 
   */
  &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function getId()
  {
    &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;id;
  }

  /**
   * Set coordinates
   *
   * @param point $coordinates
   * @&lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; Partner
   */
  &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function setCoordinates($coordinates)
  {
    $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;coordinates = $coordinates;
    &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;;
  }

  /**
   * Get coordinates
   *
   * @&lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; point 
   */
  &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function getCoordinates()
  {
    &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;coordinates;
  }
  
  &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function setLongitude($lon)
  {
    &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; ($&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;coordinates == &lt;span class=&quot;code-keyword&quot;&gt;null&lt;/span&gt;)
    {
      $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;coordinates = Point::fromLonLat($lon, 0);
    }
    &lt;span class=&quot;code-keyword&quot;&gt;else&lt;/span&gt;
    {
      $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;coordinates-&amp;gt;setLongitude($lon);
    }
  }
  
  &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function getLongitude()
  {
    &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;coordinates == &lt;span class=&quot;code-keyword&quot;&gt;null&lt;/span&gt; ? 0 : $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;coordinates-&amp;gt;getLongitude();
  }
  
  &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function setLatitude($lat)
  {
    &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; ($&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;coordinates == &lt;span class=&quot;code-keyword&quot;&gt;null&lt;/span&gt;)
    {
      $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;coordinates = Point::fromLonLat(0, $lat);
    }
    &lt;span class=&quot;code-keyword&quot;&gt;else&lt;/span&gt;
    {
      $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;coordinates-&amp;gt;setLatitude($lat);
    }
  }
  
  &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function getLatitude()
  {
    &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;coordinates == &lt;span class=&quot;code-keyword&quot;&gt;null&lt;/span&gt; ? 0 : $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;coordinates-&amp;gt;getLatitude();
  }
}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;


&lt;p&gt;3) use the update script to create the table:&lt;/p&gt;

&lt;p&gt;php app/console doctrine:schema:update --force --verbose&lt;/p&gt;


&lt;p&gt;4) run it again to update:&lt;/p&gt;

&lt;p&gt;php app/console doctrine:schema:update --force --verbose&lt;/p&gt;


&lt;p&gt;Errors should ensue:&lt;/p&gt;
&lt;div class=&quot;panel&quot; style=&quot;background-color: #FFFFCE;border-color: #ccc;border-style: dashed;border-width: 1px;&quot;&gt;&lt;div class=&quot;panelHeader&quot; style=&quot;border-bottom-width: 1px;border-bottom-style: dashed;border-bottom-color: #ccc;background-color: #F7D6C1;&quot;&gt;&lt;b&gt;Errors&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;panelContent&quot; style=&quot;background-color: #FFFFCE;&quot;&gt;
&lt;p&gt;  &lt;span class=&quot;error&quot;&gt;&amp;#91;Doctrine\DBAL\DBALException&amp;#93;&lt;/span&gt;                                                                        &lt;br/&gt;
  Unknown database type geography requested, Doctrine\DBAL\Platforms\PostgreSqlPlatform may not support it.                                                                                               &lt;/p&gt;



&lt;p&gt;Exception trace:&lt;br/&gt;
 () at /.../Symfony/vendor/doctrine-dbal/lib/Doctrine/DBAL/Platforms/AbstractPlatform.php:261&lt;br/&gt;
 Doctrine\DBAL\Platforms\AbstractPlatform-&amp;gt;getDoctrineTypeMapping() at /.../Symfony/vendor/doctrine-dbal/lib/Doctrine/DBAL/Schema/PostgreSqlSchemaManager.php:285&lt;br/&gt;
 Doctrine\DBAL\Schema\PostgreSqlSchemaManager-&amp;gt;_getPortableTableColumnDefinition() at /.../Symfony/vendor/doctrine-dbal/lib/Doctrine/DBAL/Schema/AbstractSchemaManager.php:672&lt;br/&gt;
 Doctrine\DBAL\Schema\AbstractSchemaManager-&amp;gt;_getPortableTableColumnList() at /.../Symfony/vendor/doctrine-dbal/lib/Doctrine/DBAL/Schema/AbstractSchemaManager.php:159&lt;br/&gt;
 Doctrine\DBAL\Schema\AbstractSchemaManager-&amp;gt;listTableColumns() at /.../Symfony/vendor/doctrine-dbal/lib/Doctrine/DBAL/Schema/AbstractSchemaManager.php:254&lt;br/&gt;
 Doctrine\DBAL\Schema\AbstractSchemaManager-&amp;gt;listTableDetails() at /.../Symfony/vendor/doctrine-dbal/lib/Doctrine/DBAL/Schema/AbstractSchemaManager.php:242&lt;br/&gt;
 Doctrine\DBAL\Schema\AbstractSchemaManager-&amp;gt;listTables() at /.../Symfony/vendor/doctrine-dbal/lib/Doctrine/DBAL/Schema/AbstractSchemaManager.php:830&lt;br/&gt;
 Doctrine\DBAL\Schema\AbstractSchemaManager-&amp;gt;createSchema() at /.../Symfony/vendor/doctrine/lib/Doctrine/ORM/Tools/SchemaTool.php:689&lt;br/&gt;
 Doctrine\ORM\Tools\SchemaTool-&amp;gt;getUpdateSchemaSql() at /.../Symfony/vendor/doctrine/lib/Doctrine/ORM/Tools/Console/Command/SchemaTool/UpdateCommand.php:103&lt;br/&gt;
 Doctrine\ORM\Tools\Console\Command\SchemaTool\UpdateCommand-&amp;gt;executeSchemaCommand() at /.../Symfony/vendor/doctrine/lib/Doctrine/ORM/Tools/Console/Command/SchemaTool/AbstractCommand.php:59&lt;br/&gt;
 Doctrine\ORM\Tools\Console\Command\SchemaTool\AbstractCommand-&amp;gt;execute() at /.../Symfony/vendor/symfony/src/Symfony/Bundle/DoctrineBundle/Command/Proxy/UpdateSchemaDoctrineCommand.php:62&lt;br/&gt;
 Symfony\Bundle\DoctrineBundle\Command\Proxy\UpdateSchemaDoctrineCommand-&amp;gt;execute() at /.../Symfony/vendor/symfony/src/Symfony/Component/Console/Command/Command.php:226&lt;br/&gt;
 Symfony\Component\Console\Command\Command-&amp;gt;run() at /.../Symfony/vendor/symfony/src/Symfony/Component/Console/Application.php:194&lt;br/&gt;
 Symfony\Component\Console\Application-&amp;gt;doRun() at /.../Symfony/vendor/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php:76&lt;br/&gt;
 Symfony\Bundle\FrameworkBundle\Console\Application-&amp;gt;doRun() at /.../Symfony/vendor/symfony/src/Symfony/Component/Console/Application.php:118&lt;br/&gt;
 Symfony\Component\Console\Application-&amp;gt;run() at /.../Symfony/app/console:22&lt;/p&gt;


&lt;p&gt;doctrine:schema:update &lt;span class=&quot;error&quot;&gt;&amp;#91;--complete&amp;#93;&lt;/span&gt; &lt;span class=&quot;error&quot;&gt;&amp;#91;--dump-sql&amp;#93;&lt;/span&gt; &lt;span class=&quot;error&quot;&gt;&amp;#91;--force&amp;#93;&lt;/span&gt; [--em&lt;span class=&quot;error&quot;&gt;&amp;#91;=&amp;quot;...&amp;quot;&amp;#93;&lt;/span&gt;]&lt;/p&gt;
&lt;/div&gt;&lt;/div&gt;


&lt;p&gt;What seems to be happening is that the returned type for the column holding the points is truncated. &quot;Full&quot; type is &apos;geography(Point,4326)&apos;, returned type from Doctrine is &apos;geography&apos; (missing the specifics).&lt;br/&gt;
Adding other custom mappings for PostGIS types, LineString for example, will result with the exact same error although the full type is &apos;geography(LineString,4326)&apos;. The above test case would still be erroneous with the full type returned as the mapping specifies a &apos;dbType&apos; known as &apos;point&apos; or &apos;linestring&apos; and not &apos;geography(Point,4326)&apos; or &apos;geography(LineString,4326)&apos;, adjustments should be made there.&lt;/p&gt;</description>
                <environment>Linux Debian Stable, Symfony 2.0, Doctrine 2.2.1, PostgreSQL, PostGIS</environment>
            <key id="14011">DBAL-337</key>
            <summary>Column types are truncated when mapping PostGIS types</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="5" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/resolved.png">Resolved</status>
                    <resolution id="6">Invalid</resolution>
                    <security id="10000">All</security>
                        <assignee username="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="jderrough">Jonathan Derrough</reporter>
                        <labels>
                        <label>postgis</label>
                    </labels>
                <created>Tue, 4 Sep 2012 08:38:01 +0000</created>
                <updated>Fri, 7 Sep 2012 15:33:20 +0000</updated>
                    <resolved>Wed, 5 Sep 2012 16:55:19 +0000</resolved>
                            <version>2.2.1</version>
                                                <component>Platforms</component>
                <component>Schema Managers</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>2</watches>
                        <comments>
                    <comment id="18596" author="jderrough" created="Tue, 4 Sep 2012 15:26:01 +0000"  >&lt;p&gt;Further investigation showed that the truncation makes sense in a general context as types (ex: varchar) are simplifications of complete types (ex: character varying (255)). But it still presents a problem for PostGIS users.&lt;/p&gt;

&lt;p&gt;A quick workaround would be to change the mapping to:&lt;/p&gt;
&lt;div class=&quot;code panel&quot; style=&quot;border-style: solid;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeHeader panelHeader&quot; style=&quot;border-bottom-width: 1px;border-bottom-style: solid;&quot;&gt;&lt;b&gt;in a controller&apos;s boot method&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;
$em = $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;container-&amp;gt;get(&apos;doctrine.orm.default_entity_manager&apos;);
$conn = $em-&amp;gt;getConnection();
&lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (!Type::hasType(&apos;point&apos;)) {
  Type::addType(&apos;point&apos;, &apos;Demo\GeoBundle\Lib\Type\PointType&apos;);
  $conn-&amp;gt;getDatabasePlatform()-&amp;gt;registerDoctrineTypeMapping(&apos;geography&apos;, &apos;point&apos;);
}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;It seems to work fine with several custom PostGIS types mapped but it wasn&apos;t fully tested.&lt;/p&gt;</comment>
                    <comment id="18601" author="beberlei" created="Wed, 5 Sep 2012 16:55:19 +0000"  >&lt;p&gt;The way you do it its actually a workaround, but Doctrine Bundle has a way to configure the registerDoctrineMappingType() calls via configuration.&lt;/p&gt;

&lt;p&gt;Check with &quot;php app/console config:dump-reference DoctrineBundle&quot;&lt;/p&gt;</comment>
                    <comment id="18608" author="jderrough" created="Wed, 5 Sep 2012 18:35:27 +0000"  >&lt;p&gt;Yes, I am aware of the mapping configuration with the config file. I tested it again:&lt;/p&gt;

&lt;div class=&quot;code panel&quot; style=&quot;border-style: solid;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeHeader panelHeader&quot; style=&quot;border-bottom-width: 1px;border-bottom-style: solid;&quot;&gt;&lt;b&gt;config.yml&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;
# Doctrine Configuration
doctrine:
    dbal:
        driver:   %database_driver%
        host:     %database_host%
        port:     %database_port%
        dbname:   %database_name%
        user:     %database_user%
        password: %database_password%
        charset:  UTF8
        types:
            point: Demo\GeoBundle\Lib\Type\PointType
            linestring: Demo\GeoBundle\Lib\Type\LineStringType
    orm:
        auto_generate_proxy_classes: %kernel.debug%
        auto_mapping: &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;But the issue here remains, the same error is outputed:&lt;/p&gt;

&lt;p&gt;&lt;span class=&quot;error&quot;&gt;&amp;#91;Doctrine\DBAL\DBALException&amp;#93;&lt;/span&gt;                                                                        &lt;br/&gt;
  Unknown database type geography requested, Doctrine\DBAL\Platforms\PostgreSqlPlatform may not suppo  &lt;br/&gt;
  rt it.&lt;/p&gt;

&lt;p&gt;As I detailed previously, the fetched type of a geography column is truncated. So my workaround to avoid the errors during update was to register my custom types with &apos;geography&apos; as db-type. It doesn&apos;t seem to be the right way since only one doctrine-type can be map a db-type (so here, &apos;geography&apos; would be associated with either &apos;point&apos; or &apos;linestring&apos;).&lt;/p&gt;</comment>
                    <comment id="18609" author="beberlei" created="Wed, 5 Sep 2012 21:06:21 +0000"  >&lt;p&gt;Thats only half the picture, see &quot;mapping_types&quot; here &lt;a href=&quot;http://symfony.com/doc/current/reference/configuration/doctrine.html&quot; class=&quot;external-link&quot;&gt;http://symfony.com/doc/current/reference/configuration/doctrine.html&lt;/a&gt;&lt;/p&gt;</comment>
                    <comment id="18618" author="jderrough" created="Fri, 7 Sep 2012 15:33:20 +0000"  >&lt;p&gt;With the updated config.yml:&lt;/p&gt;

&lt;div class=&quot;code panel&quot; style=&quot;border-style: solid;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeHeader panelHeader&quot; style=&quot;border-bottom-width: 1px;border-bottom-style: solid;&quot;&gt;&lt;b&gt;config.yml&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;
# Doctrine Configuration
doctrine:
    dbal:
        driver:   %database_driver%
        host:     %database_host%
        port:     %database_port%
        dbname:   %database_name%
        user:     %database_user%
        password: %database_password%
        charset:  UTF8
        types:
            point: Demo\GeoBundle\Lib\Type\PointType
            linestring: Demo\GeoBundle\Lib\Type\LineStringType
        mapping_types:
            geography(point,4326): point
            geography(linestring,4326): linestring
    orm:
        auto_generate_proxy_classes: %kernel.debug%
        auto_mapping: &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;errors are still showing.&lt;/p&gt;

&lt;p&gt;Using:&lt;/p&gt;

&lt;div class=&quot;code panel&quot; style=&quot;border-style: solid;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeHeader panelHeader&quot; style=&quot;border-bottom-width: 1px;border-bottom-style: solid;&quot;&gt;&lt;b&gt;config.yml&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;
        mapping_types:
            geography: point
            geography: linestring
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;errors are gone but I guess it is the same as:&lt;/p&gt;

&lt;div class=&quot;code panel&quot; style=&quot;border-style: solid;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;
$conn-&amp;gt;getDatabasePlatform()-&amp;gt;registerDoctrineTypeMapping(&apos;geography&apos;, &apos;point&apos;);
$conn-&amp;gt;getDatabasePlatform()-&amp;gt;registerDoctrineTypeMapping(&apos;geography&apos;, &apos;linestring&apos;);
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;and I don&apos;t see how it would be right since the &apos;linestring&apos; mapping would replace the &apos;point&apos; mapping.&lt;/p&gt;

&lt;p&gt;I&apos;m affraid I don&apos;t get it.&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>
</channel>
</rss>