Search code examples
phpsymfonysymfony-sonata

Modify existing schema for SonataPageBundle: page__site doesn't exist


After finally(!) adding SonataPageBundle to an existing app I get when going to the dev environment

SQLSTATE[42S02]: Base table or view not found: 1146 Table 'volunteer.page__site' doesn't exist

on running php app/console sonata:page:create-site. Nowhere in the documentation for the PageBundle is there any mention of how to create the schema.

If I do doctrine:schema:create --dump-sql to see what's what I get

[Doctrine\DBAL\DBALException]
Unknown column type "json" requested...


Solution

  • A search in the installed PageBundle directory (i.e., not at the Sonata-Project website) revealed the instruction to modify app/config/config.yml with

    doctrine:
        dbal:
            ...
            types:
                json: Sonata\Doctrine\Types\JsonType
    

    With this addition the schema could then be updated and a site created.

    If my sanity holds I'll fork the documentation to have it match a known good procedure.