Symfony 6.4执行make:entity创建实体失败求助
Symfony 6.4 执行
make:entity创建实体失败 在Symfony 6.4环境下执行symfony console make:entity命令创建实体时失败,错误输出如下:
C:\Users\pc\Desktop\Academy-ERP>php bin/console make:entity ! [NOTE] It looks like your app may be using a namespace other than "App". ! ! To configure this and make your life easier, see: https://symfony.com/doc/current/bundles/SymfonyMakerBundle/index.html#configuration Class name of the entity to create or update (e.g. OrangePopsicle): > Orange [critical] Error thrown while running command "make:entity". Message: "Could not determine where to locate the new class "App\Entity\Orange", maybe try with a full namespace like "\My\Full\Namespace\Orange"" In Generator.php line 63: Could not determine where to locate the new class "App\Entity\Orange", maybe try with a full namespace like "\My\Full\Namespace\Orange"
约束条件:必须使用当前Symfony 6.4版本,无法升级至最新版。
项目的composer.json内容如下:
{ "name": "invertus/academy", "type": "project", "license": "MIT", "description": "A minimal Symfony project recommended to create bare bones applications", "minimum-stability": "stable", "prefer-stable": true, "require": { "php": ">=8.1.7", "ext-ctype": "*", "ext-iconv": "*", "doctrine/doctrine-bundle": "^2.11", "doctrine/doctrine-migrations-bundle": "^3.3", "doctrine/orm": "^2.17", "runtime/frankenphp-symfony": "^0.2.0", "symfony/console": "6.4.*", "symfony/dotenv": "6.4.*", "symfony/flex": "^2", "symfony/framework-bundle": "6.4.*", "symfony/runtime": "6.4.*", "symfony/security-bundle": "6.4.*", "symfony/yaml": "6.4.*" }, "config": { "allow-plugins": { "php-http/discovery": true, "symfony/flex": true, "symfony/runtime": true }, "sort-packages": true }, "autoload": { "psr-4": { "App\\": "src/" } }, "autoload-dev": { "psr-4": { "App\\Tests\\": "tests/" } }, "replace": { "symfony/polyfill-ctype": "*", "symfony/polyfill-iconv": "*", "symfony/polyfill-php72": "*", "symfony/polyfill-php73": "*", "symfony/polyfill-php74": "*", "symfony/polyfill-php80": "*", "symfony/polyfill-php81": "*", "symfony/polyfill-php82": "*" }, "scripts": { "auto-scripts": { "cache:clear": "symfony-cmd", "assets:install %PUBLIC_DIR%": "symfony-cmd" }, "post-install-cmd": [ "@auto-scripts" ], "post-update-cmd": [ "@auto-scripts" ] }, "conflict": { "symfony/symfony": "*" }, "extra": { "symfony": { "allow-contrib": false, "require": "6.4.*", "docker": true } }, "require-dev": { "symfony/maker-bundle": "^1.52" } }
已尝试的操作:
- 安装
orm-pack、doctrine-bundle - 修改
composer.json中的命名空间配置 - 修改
kernel.php中的命名空间
以上操作均未解决问题,求可行的修复方案。
内容的提问来源于stack exchange,提问作者Marijus12
相关产品推荐
相关产品推荐

