首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >如何修复“未知的数据库类型几何请求,Doctrine\DBAL\Platform\PostgreSQL100Platform可能不支持它”。

如何修复“未知的数据库类型几何请求,Doctrine\DBAL\Platform\PostgreSQL100Platform可能不支持它”。
EN

Stack Overflow用户
提问于 2019-10-19 15:30:34
回答 1查看 2.6K关注 0票数 1

我正在准备Symfony 3.4.32 + PostgreSQL + PostGIS环境。我安装了jsor/教义-后地理信息系统,但出现了以下错误。

未知的数据库类型几何请求,Doctrine\DBAL\Platform\PostgreSQL100Platform可能不支持它。

详细信息

我使用的是EC-立方体 4.0.3,这是使用Symfony 3.4.32的开源软件。

我准备了mdillon/postgis码头集装箱。我启用PostGIS扩展,我可以使用postgis。

我通过composer安装了jsor/教义-后地理信息系统并设置了配置文件。

  1. 我将设置添加到app/config/eccube/services.yaml的底部。
代码语言:javascript
运行
复制
 services:
     # (ommitted)
      Jsor\Doctrine\PostGIS\Event\ORMSchemaEventSubscriber:
         tags:
             - { name: doctrine.event_subscriber, connection: default }
  1. 我将这三种类型(地理、几何、栅格)添加到app/config/ec多维数据集/packages/prinine.yaml中。
代码语言:javascript
运行
复制
parameters:
     # Adds a fallback DATABASE_URL if the env var is not set.
     # This allows you to run cache:warmup even if your
     # environment variables are not available yet.
     # You should not need to change this value.
     env(DATABASE_URL): ''
     env(DATABASE_SERVER_VERSION): ~
 doctrine:
     dbal:
         driver: 'pdo_pgsql'
         server_version: "%env(DATABASE_SERVER_VERSION)%"
         charset: utf8

         # for mysql only
         default_table_options:
           collate: 'utf8_general_ci'

         # With Symfony 3.3, remove the `resolve:` prefix
         url: '%env(DATABASE_URL)%'

         # types
         types:
             datetime: 'Eccube\Doctrine\DBAL\Types\UTCDateTimeType'
             datetimetz: 'Eccube\Doctrine\DBAL\Types\UTCDateTimeTzType'
             geography:
                 class: 'Jsor\Doctrine\PostGIS\Types\GeographyType'
                 commented: false
             geometry:
                 class: 'Jsor\Doctrine\PostGIS\Types\GeometryType'
                 commented: false
             raster:
                 class: 'Jsor\Doctrine\PostGIS\Types\RasterType'
                 commented: false
     orm:
         auto_generate_proxy_classes: '%kernel.debug%'
         naming_strategy: doctrine.orm.naming_strategy.underscore
         auto_mapping: true
         dql:
             string_functions:
                 NORMALIZE: Eccube\Doctrine\ORM\Query\Normalize
             numeric_functions:
                 EXTRACT: Eccube\Doctrine\ORM\Query\Extract
         filters:
             option_nostock_hidden:
                 class: Eccube\Doctrine\Filter\NoStockHiddenFilter
                 enabled: false
             incomplete_order_status_hidden:
                 class: Eccube\Doctrine\Filter\OrderStatusFilter
                 enabled: false
  1. 我编写了实体,app/Customize/ Entity /Geolocation.php。
代码语言:javascript
运行
复制
<?php
 namespace Customize\Entity;
 use Doctrine\ORM\Mapping as ORM;

 /**
  * GeoLocation
  *
  * @ORM\Table(name="dtb_geolocation")
  * @ORM\InheritanceType("SINGLE_TABLE")
  * @ORM\DiscriminatorColumn(name="discriminator_type", type="string", length=255)
  * @ORM\HasLifecycleCallbacks()
  * @ORM\Entity(repositoryClass="Customize\Repository\GeoLocationRepository")
  */
 class GeoLocation extends \Eccube\Entity\AbstractEntity
 {
     /**
      * @ORM\Column(name="gid", type="integer", options={"unsigned":true})
      * @ORM\Id
      * @ORM\GeneratedValue(strategy="IDENTITY")
      */
     public $gid;

     // (ommitted)

     /**
      * @ORM\Column(name="geom", type="geometry", options={"geometry_type"="MULTIPOLYGON", "srid"=4612}, nullable=true)
      */
     public $geom;
 }    
  1. 然后,我在PostgreSQL数据库中创建了表。

代码语言:javascript
运行
复制
bin/console eccube:generate:proxies
bin/console doctrine:schema:update --dump-sql --force
  1. 效果很好。创建"dtb_geolocation“表,并在PostgreSQL中检查它。
代码语言:javascript
运行
复制
 db=# \d dtb_geolocation ;
                                             Table "public.dtb_geolocation "
       Column       |            Type             | Collation | Nullable |                          Default
--------------------+-----------------------------+-----------+----------+-----------------------------------------------------------
 gid                | integer                     |           | not null | nextval('dtb_geolocation_pkey'::regclass)

// ommitted

 geom               | geometry(MultiPolygon,4612) |           |          | NULL::geometry
 discriminator_type | character varying(255)      |           | not null |
Indexes:
    "dtb_geolocation_pkey" PRIMARY KEY, btree (gid)

但是当我访问brower时,会发生错误。

未知的数据库类型几何请求,Doctrine\DBAL\Platform\PostgreSQL100Platform可能不支持它。

我通过bin/console cache:clear --no-warmup清除缓存,但是没有什么变化。

我犯了什么错误吗?

几何类型不包括在Symfony中吗?我该怎么查呢?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2019-10-30 04:30:40

也许这是一个电子立方体4的问题。我想doctrine.yaml是在Symfony识别数据库表之后加载的。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/58465188

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档