我正在尝试准备Symfony 3.4.32 + PostgreSQL + PostGIS环境。 我安装了jsor/doctrine-postgis,但是发生以下错误。
请求了未知的数据库类型几何,Doctrine \ DBAL \ Platforms \ PostgreSQL100Platform可能不支持。
我正在使用EC-CUBE 4.0.3,它是使用Symfony 3.4.32的开源软件。
我准备了mdillon/postgis码头集装箱。 我启用了postgis扩展,可以使用PostGIS。
我由作曲家安装了jsor/doctrine-postgis并设置了配置文件。
services:
# (ommitted)
Jsor\Doctrine\PostGIS\Event\ORMSchemaEventSubscriber:
tags:
- { name: doctrine.event_subscriber, connection: default }
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
<?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;
}
运行
bin/console eccube:generate:proxies
bin/console doctrine:schema:update --dump-sql --force
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中不包括几何类型吗?我该如何检查?
答案 0 :(得分:0)
也许这是EC-CUBE 4问题。 我猜想Symfony识别数据库表后就会加载doctrine.yaml。