From b40ae53989890525e6a0a57d408503fa46969bf4 Mon Sep 17 00:00:00 2001 From: Anton Fedurtsya Date: Thu, 4 Jan 2024 15:18:04 +0200 Subject: [PATCH] Localize UIRequest service usage Signed-off-by: Anton Fedurtsya --- .../Controller/Admin/MediaController.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/Application/Controller/Admin/MediaController.php b/src/Application/Controller/Admin/MediaController.php index ec28d87..a7fc245 100755 --- a/src/Application/Controller/Admin/MediaController.php +++ b/src/Application/Controller/Admin/MediaController.php @@ -24,7 +24,6 @@ */ class MediaController extends AdminDetailsController { - protected UIRequestInterface $request; protected ?Media $mediaService = null; protected ?ImageResourceInterface $imageResource = null; @@ -36,8 +35,6 @@ public function init() parent::init(); $this->setTemplateName('@ddoemedialibrary/dialog/ddoemedia'); - $this->request = $this->getService(UIRequestInterface::class); - $this->mediaService = $this->getService(Media::class); $this->mediaService->createDirs(); @@ -57,15 +54,17 @@ public function render() { $request = Registry::getRequest(); + $uiRequest = $this->getService(UIRequestInterface::class); $mediaRepository = $this->getService(MediaRepositoryInterface::class); - $this->addTplParam('iFileCount', $mediaRepository->getFolderMediaCount($this->request->getFolderId())); + $this->addTplParam('iFileCount', $mediaRepository->getFolderMediaCount($uiRequest->getFolderId())); $this->addTplParam('sResourceUrl', $this->imageResource->getMediaUrl()); $this->addTplParam('sThumbsUrl', $this->imageResource->getThumbnailUrl()); $this->addTplParam('sFoldername', $this->imageResource->getFolderName()); $this->addTplParam('sFolderId', $this->imageResource->getFolderId()); $this->addTplParam('sTab', $request->getRequestEscapedParameter('tab')); - $this->addTplParam('request', $this->getService(UIRequestInterface::class)); + + $this->addTplParam('request', $uiRequest); return parent::render(); } @@ -233,9 +232,11 @@ public function movefile() */ public function moreFiles() { + $uiRequest = $this->getService(UIRequestInterface::class); + $pageSize = 18; - $folderId = $this->request->getFolderId(); - $listStartIndex = $this->request->getMediaListStartIndex(); + $folderId = $uiRequest->getFolderId(); + $listStartIndex = $uiRequest->getMediaListStartIndex(); $mediaRepository = $this->getService(MediaRepositoryInterface::class); $folderMediaCount = $mediaRepository->getFolderMediaCount($folderId);