传递给 Sonata\PageBundle\Entity\BlockInteractor::__construct() 的参数 1 必须是 Symfony\Bridge\Doctrine\RegistryInterface 的实例

Argument 1 passed to Sonata\PageBundle\Entity\BlockInteractor::__construct() must be an instance of Symfony\Bridge\Doctrine\RegistryInterface

作曲家更新后我收到新错误

Argument 1 passed to Sonata\PageBundle\Entity\BlockInteractor::__construct() must be an instance of Symfony\Bridge\Doctrine\RegistryInterface, instance of Doctrine\Bundle\DoctrineBundle\Registry given,

symfony 配置

    "sonata-project/admin-bundle": "^3.48",
    "sonata-project/doctrine-orm-admin-bundle": "^3.9",
    "sonata-project/page-bundle": "^3.11",
    "sonata-project/translation-bundle": "^2.4",
    "sonata-project/user-bundle": "^4.3",
    "symfony/console": "4.3.*",
    "symfony/dotenv": "4.3.*",
    "symfony/flex": "^1.1",
    "symfony/framework-bundle": "4.3.*",

不确定,但尝试扩展 AbstractController 而不是 Controller 并使用依赖注入,我在 bundle for pagination 中遇到了类似的问题

 //the use for my example
use Knp\Component\Pager\PaginatorInterface; 


public function recap(Request $request, PaginatorInterface $paginator)

,也许就是那个

当自动更新 doctrine-bundle(至 "version": "2.0.2" )

时会出现该问题
 "doctrine/doctrine-bundle": "1.12.2",

这项工作。

这里有更多信息https://github.com/symfony/symfony/issues/29810