I installed several of the Sonata bundles (user, admin etc) on my Symfony 2 app but after using them for a while, I decided I didn't like them and wanted to remove them.
I've updated my composer.json and AppKernel.php files, removing anything to do with Sonata. I've also removed all of the relevant routes, configs and security file entries. However, I'm having trouble updating my database schema now.
I get the following error whenever I run one:
[Doctrine\DBAL\DBALException]
Unknown column type "json" requested. Any Doctrine type that you use has to
be registered with \Doctrine\DBAL\Types\Type::addType(). You can get a lis
t of all the known types with \Doctrine\DBAL\Types\Type::getTypeMap(). If t
his error occurs during database introspection then you might have forgot t
o register all database types for a Doctrine Type. Use AbstractPlatform#reg
isterDoctrineTypeMapping() or have your custom types implement Type#getMapp
edDatabaseTypes(). If the type name is empty you might have a problem with
the cache or forgot some mapping information.
I know this is from the Doctrine configuration for one of the Sonata bundles:
# Doctrine Configuration doctrine:
dbal:
driver: %database_driver%
host: %database_host%
port: %database_port%
dbname: %database_name%
user: %database_user%
password: %database_password%
charset: UTF8
#types:
# json: Sonata\Doctrine\Types\JsonType
As you can see, I've commented this out I'm still continuing to get the error.
I'm having trouble tracking down where this is still referenced.
I had the same issue as most people. There used to be an issue with installing SonataAdminBundle, but that's probably the problem if you're installing SonataAdminBundle and can't get things to work. If that's the case see this link: https://github.com/sonata-project/SonataAdminBundle/issues/811
In My case, and most other people here, this happened when removing SonataAdminBundle, for some reason it's hanging around like a bad smell. I tried removing the database and restoring it again among other things which didn't work.
So the following hack seems to get # Doctrine Configuration
doctrine:
dbal:
...
types: #this is about this line and line below
json: \Doctrine\DBAL\Types\StringType
Definitely not a perfect workaround but should get things back to the way they were until you actually need JsonType and you can introduce the type then.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With