I want to use the command sonata:admin:generate for generating an admin from an entity, but the following error occurs every time:
[RuntimeException] There are no model managers registered.
Any ideas why this might be?
我会猜一猜,但是您是否按照此处的描述安装了 SonataDoctrineORMAdminBundle?
I have similar problem. When i try generate admin classes i get error:
In AdminMaker.php line 295:
There are no model managers registered.
But, I have installed and activated bundles SonataDoctrineORMAdminBundle in bundles.php
Sonata\DatagridBundle\SonataDatagridBundle::class => ['all' => true],
Sonata\CoreBundle\SonataCoreBundle::class => ['all' => true],
Sonata\BlockBundle\SonataBlockBundle::class => ['all' => true],
Knp\Bundle\MenuBundle\KnpMenuBundle::class => ['all' => true],
Sonata\AdminBundle\SonataAdminBundle::class => ['all' => true],
What is wrong? What is this "model manager"? Doctrine bundle is installed and configured too...
doctrine:
dbal:
# configure these for your database server
# use postgresql for PostgreSQL
# use sqlite for SQLite
driver: 'mysql'
server_version: '5.7'
# only needed for MySQL
charset: utf8mb4
default_table_options:
charset: utf8mb4
collate: utf8mb4_unicode_ci
url: '%env(resolve:DATABASE_URL)%'
orm:
auto_generate_proxy_classes: true
naming_strategy: doctrine.orm.naming_strategy.underscore
auto_mapping: true
mappings:
App:
is_bundle: false
type: annotation
dir: '%kernel.project_dir%/src/Entity'
prefix: 'App\Entity'
alias: App
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.