Mapping exception after install SonataMediaBundle
After reads and try several things I found where the error was. In my doctrine config I have:
orm: auto_generate_proxy_classes: "%kernel.debug%"# auto_mapping: true entity_managers: default: mappings: ApplicationSonataMediaBundle: ~ SonataMediaBundle: ~
By removing the auto_mapping clause, I no longer register UserBundle in the doctrine’s mapping directories. Hence it cannot find your User entity. So solution was either uncomment the auto_mapping: true
from your config and comment the entity_manager.default.mappings
part, or explicitly specify your User bundle in the section. So I pick the first one and my code looks like this now:
orm: auto_generate_proxy_classes: "%kernel.debug%" auto_mapping: true# entity_managers:# default:# mappings:# ApplicationSonataMediaBundle: ~# SonataMediaBundle: ~
remove it again and run following command, php app/console sonata:easy-extends:generate --dest=src SonataMediaBundle
... You forgot the --dest=src
and just by moving the files you won't have changed all the namespaces.
I found solution where it should be:
doctrine: orm: auto_generate_proxy_classes: %kernel.debug% entity_managers: default: auto_mapping: true mappings: ApplicationSonataMediaBundle: ~ SonataMediaBundle: ~
auto_mapping: true must be into doctrine, orm, entity_managers, default section and not into doctrine, orm.