2017-09-28 81 views
2

開發使用Symfony的2.7未知的數據庫類型json的要求,原則 DBAL 平臺 PostgreSqlPlatform可能不支持它

實體其中包含屬性

/** 
* @var array 
* @ORM\Column(name="new_entry_name", type="json_array", nullable=true) 
*/ 
protected $newEntryName; 

但當我更新我的架構使用

php app/console doctrine:schema:update --force 

它顯示我錯誤

$ php app/console doctrine:schema:update --force 
[Doctrine\DBAL\DBALException]                   

Unknown database type json requested, Doctrine\DBAL\Platforms\PostgreSqlPlatform may not support it. 

config.yml文件我已經添加了此類型。

doctrine: dbal: driver: "pdo_pgsql" host: "%database_host%" port: "%database_port%" dbname: "%database_name%" user: "%database_user%" password: "%database_password%" charset: UTF8 mapping_types: enum: string set: string varbinary: string tinyblob: text types: json: Sonata\Doctrine\Types\JsonType

我應該怎麼做才能避免這個錯誤.Thanks

回答

0

爲了避免這個錯誤添加

json: json_array 

json: json 

config.ymlmapping_types部分。

所以,mapping_types部分應該是這樣的:

mapping_types: 
    enum: string 
    set: string 
    varbinary: string 
    tinyblob: text 
    json: json_array 
+0

它已經存在。 mapping_types: 枚舉:字符串 集:字符串 VARBINARY:字符串 TINYBLOB:文本 類型: JSON:索納塔\原則\類型\ JsonType –