Reputation: 59
Developing using Symfony 2.7
I have entity which contain attribute
/**
* @var array
* @ORM\Column(name="new_entry_name", type="json_array", nullable=true)
*/
protected $newEntryName;
but when i update my schema using
php app/console doctrine:schema:update --force
it shows me error
$ php app/console doctrine:schema:update --force
[Doctrine\DBAL\DBALException]
Unknown database type json requested, Doctrine\DBAL\Platforms\PostgreSqlPlatform may not support it.
In config.yml file i have added this type.
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
what should i do to avoid this error .Thanks
Upvotes: 3
Views: 3063
Reputation: 11
To avoid this error add
json: json_array
or
json: json
in config.yml
under mapping_types
section.
So, mapping_types
section should look like this:
mapping_types:
enum: string
set: string
varbinary: string
tinyblob: text
json: json_array
Upvotes: 1