Symfony2 的 doctirne:mapping:import 中未知数据库类型几何请求错误

Man*_*mar 5 doctrine symfony doctrine-orm sql-server-2012

我在 Symfony2 中运行doctrine:mapping:import 命令时收到以下错误。我正在使用 SQL Server 2012,即使错误显示“2008Platform 可能不支持它”。

  [Doctrine\DBAL\DBALException]                                                
  Unknown database type geometry requested, Doctrine\DBAL\Platforms\SQLServer  
  2008Platform may not support it. 
Run Code Online (Sandbox Code Playgroud)

我的数据库配置如下所示:

doctrine:
dbal:
    driver:   pdo_sqlsrv
    host:     localhost
    port:     1433
    dbname:   test
    user:     user
    password: password
    charset:  UTF8
Run Code Online (Sandbox Code Playgroud)

我还尝试将映射类型设置为字符串。但它给出了同样的错误。

当我使用 MyMainBundle string --force 尝试该命令时。我收到此错误:

 [Doctrine\ORM\Tools\Export\ExportException]          
  The specified export driver 'string' does not exist
Run Code Online (Sandbox Code Playgroud)

我在这里使用了php 的驱动程序。

Jen*_*gar 0

根据错误消息,您尝试导入架构的表之一包含几何类型的列。Afaik Doctrine2 不支持开箱即用的几何类型(希望很快会改变)。

可能有帮助的一件事是创建自定义映射类型,如下所述:http ://docs.doctrine-project.org/projects/doctrine-orm/en/latest/cookbook/custom-mapping-types.html

您可以尝试的另一个选择是 Doctrine-spatial 包,可以在这里找到: https: //github.com/djlambert/doctrine2-spatial

不确定这是否适用于基于 mssql 的服务器......

  • 我确定我没有几何类型列 (2认同)