php - "Argument 1 passed to ApiPlatform\Core\Bridge\Doctrine\Orm\Metadata\Property\DoctrineOrmPropertyMetadataFactory::__construct() must be an instance..."

标签 php symfony doctrine-orm composer-php api-platform.com

尝试安装 Api-Platform(或在现有 Api-Platform 安装上运行 composer update)时,我收到如下错误:

Uncaught Error: Argument 1 passed to ApiPlatform\Core\Bridge\Doctrine\Orm\Metadata\Property\DoctrineOrmPropertyMetadataFactory::__construct() must be an instance of Doctrine\Common\Persistence\ManagerRegistry, instance of Doctrine\Bundle\DoctrineBundle\Registry given, called in App_KernelDevDebugContainer.php on line 1530 ["exception" => TypeError { …}]

我该怎么做才能正确安装 Api-Platform?为什么更新失败?

最佳答案

在新版本的 Api-Platform 发布之前(可能会相对较快),您可以通过将以下内容添加到 composer.json 来回避该问题:

"conflict": {
    "doctrine/common": ">= 3.0",
    "doctrine/persistence": "^1.0"
}

(由于您可能已经有一个conflict 键,因此只需将这一行添加到您现有的conflict 规则中即可)。

新版本doctrine/common已发布,当前版本的Api-Platform与其不兼容。

在不久的将来,一旦新版本的 Api-Platform 发布,您就可以删除该行。

Here您可以密切关注这个问题的讨论,并希望跟踪该问题何时在此 bundle 级别得到解决。


这不再是必要的。您可以使用最新的 Api-Platform 软件包更新到最新的 Doctrine 软件包,并且每个软件包都可以正常工作。

关于php - "Argument 1 passed to ApiPlatform\Core\Bridge\Doctrine\Orm\Metadata\Property\DoctrineOrmPropertyMetadataFactory::__construct() must be an instance...",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63619610/

相关文章:

javascript - 重复函数导致模态标题

php - undefined variable $submit

php - 允许网络用户使用 PHP 和 Javascript 更新文本文件的最简单方法?

php - Symfony2 : get Doctrine in a generic PHP class

cakephp - 无法在 cakePHP 中重新声明 config() 错误

javascript - 如何使用 Twig 中实体的现有数据预先填充集合原型(prototype)?

javascript - PHP Symfony API 和 jQuery Ajax 请求

php - Symfony2 Profiler 数据库面板中的空结果

PHPStan 没有看到适用于 Doctrine 的对象管理器

symfony - JMS 序列化器通过继承反序列化学说实体