如何解决“请求的未知数据库类型几何,Doctrine \ DBAL \ Platforms \ PostgreSQL100Platform可能不支持。” >> [

问题描述 投票:0回答:1
我正在尝试准备Symfony 3.4.32 + PostgreSQL + PostGIS环境。我安装了jsor/doctrine-postgis,但发生以下错误。

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

详细信息

我正在使用EC-CUBE 4.0.3,它是使用Symfony 3.4.32的开源软件。

我准备了mdillon/postgis docker容器。我启用了postgis扩展,可以使用PostGIS。

我通过作曲家安装了jsor/doctrine-postgis,并设置了配置文件。

    我将设置添加到app / config / eccube / services.yaml的底部。
  1. services: # (ommitted) Jsor\Doctrine\PostGIS\Event\ORMSchemaEventSubscriber: tags: - { name: doctrine.event_subscriber, connection: default }
    我将三种类型(地理,几何,栅格)添加到app / config / eccube / packages / doctrine.yaml。
  • 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
      我准备了Entity,app / Customize / Entity / Geolocation.php。
  • <?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; }
      然后我在PostgreSQL数据库中创建了表。
  • 运行

    bin/console eccube:generate:proxies bin/console doctrine:schema:update --dump-sql --force

      效果很好。创建了“ dtb_geolocation”表,并在PostgreSQL中对其进行了检查。
  • 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)
    但是当我使用浏览器访问时,会发生错误。

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

    我按bin/console cache:clear --no-warmup清除了缓存,但没有任何变化。

    我有没有犯错?Symfony中不包括几何类型吗?如何检查?

    我正在尝试准备Symfony 3.4.32 + PostgreSQL + PostGIS环境。我安装了jsor / doctrine-postgis,但是发生以下错误。请求了未知的数据库类型几何,Doctrine \ DBAL \ ...

  • postgresql symfony doctrine postgis
    1个回答
    0
    投票
    也许这是EC-CUBE 4问题。我猜想Symfony识别数据库表后会加载doctrine.yaml。
    © www.soinside.com 2019 - 2024. All rights reserved.