您请求了一项合成服务("请求").驾驶员信息中心不知道如何构建此服务


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('Avtostil'SharedBundle'Entity'Gallery')->findAll();
        $paginator = $this->get('knp_paginator');
        $pagination = $paginator->paginate($list, $request->query->getInt('page', 1)/* page number */, 3/* limit per page */);
        $pagination->setUsedRoute('Avtostil'SharedBundle'Entity'Page::GALLERY_LISTING); /* QUICK AND DIRTY */
        $data = [];
        $data['galleries'] = $pagination;
        echo "<pre>";
        'Doctrine'Common'Util'Debug::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版本中得到了修复。