“传递给ApiPlatform \ Core \ Bridge \ Doctrine \ Orm \ Metadata \ Property \ DoctrineOrmPropertyMetadataFactory :: __ construct()的参数1必须是实例..." [英] "Argument 1 passed to ApiPlatform\Core\Bridge\Doctrine\Orm\Metadata\Property\DoctrineOrmPropertyMetadataFactory::__construct() must be an instance..."
问题描述
在尝试安装Api平台(或在现有的Api平台安装上运行 composer update
时),我收到如下错误:
While attempting to install Api-Platform (or run composer update
on an existing Api-Platform installation, I get an error like this:
未捕获的错误:参数1传递给ApiPlatform \ Core \ Bridge \ Doctrine \ Orm \ Metadata \ Property \ DoctrineOrmPropertyMetadataFactory :: __ construct()必须是Doctrine \ Common \ Persistence \ ManagerRegistry的实例,Doctrine \ Bundle \ DoctrineBundle的实例给出的\ Registry,在第1530行的App_KernelDevDebugContainer.php中调用["exception"=>TypeError {…}]
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?为什么更新失败?
What can I do to be able to install Api-Platform correctly? Why is it failing on an update?
推荐答案
在发布新版本的Api-Platform之前(可能会很快推出),您可以通过将其添加到您的 composer中来回避问题.json
:
Until a new version of Api-Platform is released (which will probably be relatively soon), you can sidestep the issue by adding this to your composer.json
:
"conflict": {
"doctrine/common": ">= 3.0",
"doctrine/persistence": "^1.0"
}
(由于您可能已经具有 conflict
键,所以只需将一行添加到现有的 conflict
规则中即可).
(Since you are likely to already have a conflict
key, just add the one line to your existing conflict
rules).
发布了新版本的
A new version ofdoctrine/common
was released, and the current version of Api-Platform is not compatible with it.
在不久的将来,一旦发布了新版本的Api-Platform,您就可以删除该行.
Sometime in the near future you'll be able to remove that line, once a new version of Api-Platform is released.
此处是您可以随时关注讨论的问题,并希望在此捆绑包级别跟踪问题何时得以解决.
Here is an issue where you can keep an eye on the discussion, and hopefully track when the issue is resolved at this bundle's level.
这不再是必需的.您可以使用最新的Api-Platform软件包来更新到最新的Doctrine软件包,并且每个软件包都可以正常工作.
This is no longer necessary. You can update to the latest Doctrine packages with the latest Api-Platform package, and every works fine together.
这篇关于“传递给ApiPlatform \ Core \ Bridge \ Doctrine \ Orm \ Metadata \ Property \ DoctrineOrmPropertyMetadataFactory :: __ construct()的参数1必须是实例..."的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!