From 33f7c40dcea832d8d127b6a9f82171e4eee481aa Mon Sep 17 00:00:00 2001 From: Ben Walch Date: Tue, 10 Dec 2024 10:31:01 +0100 Subject: [PATCH] add routing methods, code style --- config/pimcore/routing.yaml | 5 +++++ config/pimcore/routing/frontend_routing.yaml | 4 +++- src/Controller/Admin/SettingsController.php | 1 + src/Manager/QueueManager.php | 1 + 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/config/pimcore/routing.yaml b/config/pimcore/routing.yaml index 7aba956..649ab1c 100644 --- a/config/pimcore/routing.yaml +++ b/config/pimcore/routing.yaml @@ -1,23 +1,27 @@ dynamic_search.controller.admin.get_state: path: /admin/dynamic-search/settings/health-state + methods: [ GET ] defaults: { _controller: DynamicSearchBundle\Controller\Admin\SettingsController::healthStateAction } options: expose: true dynamic_search.controller.admin.get_provider: path: /admin/dynamic-search/settings/provider + methods: [ GET ] defaults: { _controller: DynamicSearchBundle\Controller\Admin\SettingsController::providerAction } options: expose: true dynamic_search.controller.admin.get_context_full_configuration: path: /admin/dynamic-search/settings/context-full-configuration + methods: [ GET ] defaults: { _controller: DynamicSearchBundle\Controller\Admin\SettingsController::contextFullConfigurationAction } options: expose: true dynamic_search.controller.admin.index_queue.get_info: path: /admin/dynamic-search/settings/index-queue/info + methods: [ GET ] defaults: { _controller: DynamicSearchBundle\Controller\Admin\SettingsController::indexQueueInfoAction } options: expose: true @@ -38,4 +42,5 @@ dynamic_search.controller.admin.index_queue.clear: dynamic_search.controller.json_search: path: /dynamic-search/{contextName}/j-{outputChannelName} + methods: [ GET ] defaults: { _controller: DynamicSearchBundle\Controller\SearchController::jsonSearchAction } diff --git a/config/pimcore/routing/frontend_routing.yaml b/config/pimcore/routing/frontend_routing.yaml index 5600eaa..307653b 100644 --- a/config/pimcore/routing/frontend_routing.yaml +++ b/config/pimcore/routing/frontend_routing.yaml @@ -1,7 +1,9 @@ dynamic_search_frontend_search_list: path: /dynamic-search/{contextName}/{outputChannelName} + methods: [ GET ] defaults: { _controller: DynamicSearchBundle\Controller\SearchFrontendController::searchAction } dynamic_search_frontend_multi_search_list: path: /dynamic-search/{contextName}/collection/{outputChannelName} - defaults: { _controller: DynamicSearchBundle\Controller\SearchFrontendController::multiSearchAction } \ No newline at end of file + methods: [ GET ] + defaults: { _controller: DynamicSearchBundle\Controller\SearchFrontendController::multiSearchAction } diff --git a/src/Controller/Admin/SettingsController.php b/src/Controller/Admin/SettingsController.php index 1b48c23..1163aa6 100644 --- a/src/Controller/Admin/SettingsController.php +++ b/src/Controller/Admin/SettingsController.php @@ -83,6 +83,7 @@ public function indexQueueAllDataAction(Request $request, ContextRunnerInterface public function clearIndexQueueAction(QueueManagerInterface $queueManager): Response { $queueManager->clearQueue(); + return new Response(); } diff --git a/src/Manager/QueueManager.php b/src/Manager/QueueManager.php index 797bb3b..d106a82 100644 --- a/src/Manager/QueueManager.php +++ b/src/Manager/QueueManager.php @@ -23,6 +23,7 @@ public function getTotalQueuedItems(): int { $qb = $this->connection->createQueryBuilder(); $qb->select('COUNT(id)')->from($this->tableName); + return (int)$qb->executeQuery()->fetchOne(); }