英文:
symfony Cannot find the entity manager for class "App\Entity\User"
问题
"After upgrade to last symfony 5.4 update, I remove user entity/repository to restart and remove all deprecations.
To recreate User entity/repository, I run:
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"
```"
<details>
<summary>英文:</summary>
After upgrade to last symfony 5.4 update, I remove user entity/repository to restart and remove all deprecations.
To recreate User entity/repository, I run :
```bash
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"
答案1
得分: 2
根据 https://github.com/symfony/maker-bundle/issues/1158#issuecomment-1210446372 中提到的内容,在 config/packages/doctrine.yaml 中添加 type: attribute,就像这样:
# config/packages/doctrine.yaml
mappings:
App:
is_bundle: false
dir: '%kernel.project_dir%/src/Entity'
prefix: 'App\Entity'
alias: App
type: attribute
英文:
as mentionned in https://github.com/symfony/maker-bundle/issues/1158#issuecomment-1210446372,
add in config/packages/doctrine.yaml type: attribute like that :
# config/packages/doctrine.yaml
mappings:
App:
is_bundle: false
dir: '%kernel.project_dir%/src/Entity'
prefix: 'App\Entity'
alias: App
type: attribute
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论