symfony找不到类“App\Entity\User”的实体管理器

nwnhqdif  于 2023-04-07  发布在  其他
关注(0)|答案(1)|浏览(127)

升级到最后一次symfony 5.4更新后,我删除了用户实体/存储库以重新启动并删除所有弃用。
要重新创建用户实体/存储库,我运行:

php bin/console make:user --is-entity --with-password
# it returns
In DoctrineHelper.php line 91:
                                                              
  Cannot find the entity manager for class "App\Entity\User"
sqxo8psd

sqxo8psd1#

如https://github.com/symfony/maker-bundle/issues/1158#issuecomment-1210446372中所述,
config/packages/doctrine.yaml中添加类型:attribute如下:

# config/packages/doctrine.yaml
        mappings:
            App:
                is_bundle: false
                dir: '%kernel.project_dir%/src/Entity'
                prefix: 'App\Entity'
                alias: App
                type: attribute

相关问题