“Argument 1 passed to ApiPlatform\Core\Bridge\Doctrine\Orm\Metadata\Property\DoctrineOrmPropertyMetadataFactory::__construct() must be an instance…”

我怕爱的太早我们不能终老 提交于 2021-01-20 08:53:45

问题


While attempting to install Api-Platform (or run composer update on an existing Api-Platform installation, I get an error like this:

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 { …}]

What can I do to be able to install Api-Platform correctly? Why is it failing on an update?


回答1:


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"
}

(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.

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.


This is no longer necessary. You can update to the latest Doctrine packages with the latest Api-Platform package, and every works fine together.



来源:https://stackoverflow.com/questions/63619610/argument-1-passed-to-apiplatform-core-bridge-doctrine-orm-metadata-property-doc

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!