Symfony/ 任何调用 make:entity 的尝试都可能出现 Doctrine 错误

Symfony/ possibly Doctrine error on any attempts of calling make:entity

在尝试调用“php bin/console make:entity”时,我收到以下错误:

在 DoctrineHelper.php 第 180 行:

Class“Doctrine\Persistence\Mapping\Driver\AnnotationDriver”不存在

我检查了供应商,那里似乎有 没有 文件 AnnotationDriver.php,但我不确定如何继续。

使用以下内容:

  "type": "project",
"license": "proprietary",
"require": {
    "php": ">=7.1.3",
    "ext-ctype": "*",
    "ext-iconv": "*",
    "curl/curl": "^2.3",
    "doctrine/annotations": "^1.13",
    "doctrine/doctrine-bundle": "^2.6",
    "doctrine/doctrine-migrations-bundle": "^3.2",
    "doctrine/orm": "^2.11",
    "easycorp/easyadmin-bundle": "*",
    "friendsofsymfony/rest-bundle": "^3.3",
    "guzzlehttp/guzzle": "^7.4",
    "lcobucci/jwt": "*",
    "nelmio/cors-bundle": "^2.2",
    "phpdocumentor/reflection-docblock": "^5.3",
    "sensio/framework-extra-bundle": "^6.2",
    "symfony/asset": "*",
    "symfony/console": "4.4.*",
    "symfony/dotenv": "4.4.*",
    "symfony/expression-language": "4.4.*",
    "symfony/flex": "^1.3.1",
    "symfony/form": "4.4.*",
    "symfony/framework-bundle": "4.4.*",
    "symfony/http-foundation": "4.4.*",
    "symfony/monolog-bundle": "^3.7",
    "symfony/property-access": "4.4.*",
    "symfony/property-info": "4.4.*",
    "symfony/proxy-manager-bridge": "4.4.*",
    "symfony/security-bundle": "4.4.*",
    "symfony/serializer": "4.4.*",
    "symfony/twig-bundle": "4.4.*",
    "symfony/validator": "4.4.*",
    "symfony/yaml": "4.4.*"
}

在我的 composer.json 中。 我尝试升级和降级 doctrine/orm 但没有帮助。

我想你就是我刚刚在 symfony github discussion 上回答的那个人。

这是我的回答:

所以我在网上查了类似的问题 I found this

您需要更改 composer.json 并将 doctrine/orm 降级到 2.11,直到迁移到 symfony 5.4,因为 symfony 4.4 support has been dropped.

所以修改你的 composer.json 为:

"doctrine/orm": "^2.11",

还有:

"conflict": {
        "symfony/symfony": "*",
        "doctrine/orm": "2.12.0"
    },

别忘了运行composer update