Author : beriba | 12/01/2012

Quick solution to a problem that took me a while to resolve. It’s very simple but I couldn’t find the solution just by asking uncle google. In my case I was trying to execute

php app/console doctrine:schema:update --dump-sql

and it responded me with big red exception

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 list
of all the known types with \Doctrine\DBAL\Types\Type::getTypeMap(). If this 
error occurs during database introspection then you might have forgot to 
register all database types for a Doctrine Type. 
Use AbstractPlatform#registerDoctrineTypeMapping() or have your custom types 
implement Type#getMappedDatabaseTypes(). If the type name is empty you might 
have a problem with the cache or forgot some mapping information.

First thing to do in that case is to install Sonata Doctrine Extensions in your symfony. There are three steps to do this:
1. Add those lines to file deps in symfony root directory:


2. Execute command:

php bin/vendors install

3. Change app/autoload.php file. Your Sonata section shoud look like this

// app/autoload.php
'Sonata' => array(

This will install Sonata Doctrine Extensions.

Second thing to do to get rid of the main problem – check if your app/config/config.yml file look like this:

# app/config/config.yml
        types: #this is about this line and line below
            json:     Sonata\Doctrine\Types\JsonType

This should do the work.