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: ~