From e5dd730b83a5431e598ed49f3e1e18f49932bc51 Mon Sep 17 00:00:00 2001 From: Rustam Mamadaminov Date: Mon, 22 Nov 2021 10:48:50 +0500 Subject: [PATCH] Adapt to router changes (#38) --- src/Controller/DebugController.php | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/Controller/DebugController.php b/src/Controller/DebugController.php index 7e6dc72..b7fe055 100644 --- a/src/Controller/DebugController.php +++ b/src/Controller/DebugController.php @@ -5,8 +5,8 @@ namespace Yiisoft\Yii\Debug\Api\Controller; use Psr\Http\Message\ResponseInterface; -use Psr\Http\Message\ServerRequestInterface; use Yiisoft\DataResponse\DataResponseFactoryInterface; +use Yiisoft\Router\CurrentRouteInterface; use Yiisoft\Yii\Debug\Api\Repository\CollectorRepositoryInterface; /** @@ -38,27 +38,27 @@ public function index(): ResponseInterface /** * Summary about a processed request identified by ID specified. * - * @param ServerRequestInterface $request + * @param CurrentRouteInterface $currentRoute * * @return ResponseInterface */ - public function summary(ServerRequestInterface $request): ResponseInterface + public function summary(CurrentRouteInterface $currentRoute): ResponseInterface { - $data = $this->collectorRepository->getSummary($request->getAttribute('id')); + $data = $this->collectorRepository->getSummary($currentRoute->getArgument('id')); return $this->responseFactory->createResponse($data); } /** * Detail information about a processed request identified by ID. * - * @param ServerRequestInterface $request + * @param CurrentRouteInterface $currentRoute * * @return ResponseInterface response. */ - public function view(ServerRequestInterface $request): ResponseInterface + public function view(CurrentRouteInterface $currentRoute): ResponseInterface { $data = $this->collectorRepository->getDetail( - $request->getAttribute('id') + $currentRoute->getArgument('id') ); return $this->responseFactory->createResponse($data); @@ -67,14 +67,14 @@ public function view(ServerRequestInterface $request): ResponseInterface /** * Dump information about a processed request identified by ID. * - * @param ServerRequestInterface $request + * @param CurrentRouteInterface $currentRoute * * @return ResponseInterface response. */ - public function dump(ServerRequestInterface $request): ResponseInterface + public function dump(CurrentRouteInterface $currentRoute): ResponseInterface { $data = $this->collectorRepository->getDumpObject( - $request->getAttribute('id') + $currentRoute->getArgument('id') ); return $this->responseFactory->createResponse($data); @@ -83,15 +83,15 @@ public function dump(ServerRequestInterface $request): ResponseInterface /** * Object information about a processed request identified by ID. * - * @param ServerRequestInterface $request + * @param CurrentRouteInterface $currentRoute * * @return ResponseInterface response. */ - public function object(ServerRequestInterface $request): ResponseInterface + public function object(CurrentRouteInterface $currentRoute): ResponseInterface { $data = $this->collectorRepository->getObject( - $request->getAttribute('id'), - $request->getAttribute('objectId') + $currentRoute->getArgument('id'), + $currentRoute->getArgument('objectId') ); return $this->responseFactory->createResponse($data);