加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > PHP教程 > 正文

php – 您已请求合成服务(“请求”). DIC不知道如何构建此服务

发布时间:2020-12-13 17:01:22 所属栏目:PHP教程 来源:网络整理
导读:You have requested a synthetic service (“request”). The DIC does not know how to construct this service. 在composer.json中添加“knplabs / knp-paginator-bundle”:“~2.5.3”后收到错误并运行更新. public function listingAction(Request $requ

You have requested a synthetic service (“request”). The DIC does not know how to construct this service.

在composer.json中添加“knplabs / knp-paginator-bundle”:“~2.5.3”后收到错误并运行更新.

public function listingAction(Request $request)
    {
        $em = $this->getDoctrine()->getManager();

        $list = $em->getRepository('AvtostilSharedBundleEntityGallery')->findAll();

        $paginator = $this->get('knp_paginator');
        $pagination = $paginator->paginate($list,$request->query->getInt('page',1)/* page number */,3/* limit per page */);
        $pagination->setUsedRoute(AvtostilSharedBundleEntityPage::GALLERY_LISTING); /* QUICK AND DIRTY */

        $data = [];
        $data['galleries'] = $pagination;
        echo "<pre>";
        DoctrineCommonUtilDebug::dump('here');
        die();
        return $this->render('AvtostilOpenBundle:Gallery:listing.html.twig',$data);
    }

转储是好的,当我删除错误happing?

in appDevDebugProjectContainer.php line 4094
at appDevDebugProjectContainer->getRequestService() in bootstrap.php.cache line 2189
at Container->get('request','2') in appDevDebugProjectContainer.php line 7503
at appDevDebugProjectContainer->synchronizeRequestService() in bootstrap.php.cache line 2125
at Container->set('request',null,'request') in bootstrap.php.cache line 3278
at ContainerAwareHttpKernel->handle(object(Request),'1',true) in bootstrap.php.cache line 2479
at Kernel->handle(object(Request)) in app_dev.php line 29

解决方法

查看 https://github.com/symfony/symfony/issues/19840,它与您的代码无关,但它是2.7.17和2.8.10版本附带的Symfony错误.我认为应该发布新标签,因为它将很快修复此错误,因为它将使用RequestStack服务打破大多数项目.

编辑:该问题已在2.8.11和2.7.18版本中修复.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读