From eaeaf8cdb901a61dbfecfed641d9b5ea742090ca Mon Sep 17 00:00:00 2001 From: Vincent Langlet Date: Tue, 21 Nov 2023 17:19:43 +0100 Subject: [PATCH] Solve deprecations (#1724) --- composer.json | 2 +- src/Controller/BlockAdminController.php | 6 ++---- src/Controller/PageAdminController.php | 8 ++++---- src/Controller/SiteAdminController.php | 2 +- 4 files changed, 8 insertions(+), 10 deletions(-) diff --git a/composer.json b/composer.json index 775fe58c7..580009a7b 100644 --- a/composer.json +++ b/composer.json @@ -25,7 +25,7 @@ "cocur/slugify": "^4.0", "doctrine/doctrine-bundle": "^2.7", "doctrine/persistence": "^3.0.2", - "sonata-project/admin-bundle": "^4.19", + "sonata-project/admin-bundle": "^4.28", "sonata-project/block-bundle": "^4.18 || ^5.0", "sonata-project/doctrine-extensions": "^1.18 || ^2.1", "sonata-project/doctrine-orm-admin-bundle": "^4.0", diff --git a/src/Controller/BlockAdminController.php b/src/Controller/BlockAdminController.php index 7e2acdaae..58eb904d9 100644 --- a/src/Controller/BlockAdminController.php +++ b/src/Controller/BlockAdminController.php @@ -101,10 +101,8 @@ public function createAction(Request $request): Response unset($blockServices[$code]); } - return $this->renderWithExtraParams('@SonataPage/BlockAdmin/select_type.html.twig', [ + return $this->render('@SonataPage/BlockAdmin/select_type.html.twig', [ 'blockServices' => $blockServices, - 'base_template' => $this->getBaseTemplate(), - 'admin' => $this->admin, 'action' => 'create', ]); } @@ -171,7 +169,7 @@ public function composePreviewAction(Request $request): Response \assert($blockManager instanceof BlockServiceManagerInterface); $blockService = $blockManager->get($existingObject); - return $this->renderWithExtraParams('@SonataPage/BlockAdmin/compose_preview.html.twig', [ + return $this->render('@SonataPage/BlockAdmin/compose_preview.html.twig', [ 'container' => $container, 'child' => $existingObject, 'blockService' => $blockService, diff --git a/src/Controller/PageAdminController.php b/src/Controller/PageAdminController.php index c8b48ef5a..a5c460552 100644 --- a/src/Controller/PageAdminController.php +++ b/src/Controller/PageAdminController.php @@ -119,7 +119,7 @@ public function treeAction(Request $request): Response $theme = $this->admin->getFilterTheme(); $this->setFormTheme($formView, $theme); - return $this->renderWithExtraParams($this->admin->getTemplateRegistry()->getTemplate('tree'), [ + return $this->render($this->admin->getTemplateRegistry()->getTemplate('tree'), [ 'action' => 'tree', 'sites' => $sites, 'currentSite' => $currentSite, @@ -153,7 +153,7 @@ public function createAction(Request $request): Response $current = false; } - return $this->renderWithExtraParams($this->admin->getTemplateRegistry()->getTemplate('select_site'), [ + return $this->render($this->admin->getTemplateRegistry()->getTemplate('select_site'), [ 'sites' => $sites, 'current' => $current, ]); @@ -237,7 +237,7 @@ public function composeAction(Request $request): Response } } - return $this->renderWithExtraParams($this->admin->getTemplateRegistry()->getTemplate('compose'), [ + return $this->render($this->admin->getTemplateRegistry()->getTemplate('compose'), [ 'object' => $page, 'action' => 'edit', 'template' => $template, @@ -314,7 +314,7 @@ public function composeContainerShowAction(Request $request): Response } } - return $this->renderWithExtraParams($this->admin->getTemplateRegistry()->getTemplate('compose_container_show'), [ + return $this->render($this->admin->getTemplateRegistry()->getTemplate('compose_container_show'), [ 'blockServices' => $blockServices, 'blockAdmin' => $blockAdmin, 'container' => $block, diff --git a/src/Controller/SiteAdminController.php b/src/Controller/SiteAdminController.php index 6d7c7847e..2f4ee3130 100644 --- a/src/Controller/SiteAdminController.php +++ b/src/Controller/SiteAdminController.php @@ -73,7 +73,7 @@ public function snapshotsAction(Request $request): Response return new RedirectResponse($this->admin->generateUrl('edit', ['id' => $object->getId()])); } - return $this->renderWithExtraParams('@SonataPage/SiteAdmin/create_snapshots.html.twig', [ + return $this->render('@SonataPage/SiteAdmin/create_snapshots.html.twig', [ 'action' => 'snapshots', 'object' => $object, ]);