尝试安装 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/