From 6452d647061c3820dee69b96159f2ac95ba2ca16 Mon Sep 17 00:00:00 2001 From: Kamil Kokot Date: Tue, 24 Nov 2020 22:39:43 +0100 Subject: [PATCH] Fix the build --- .gitignore | 1 + .../Controller/ProvinceController.php | 24 ++++++------- .../CoreBundle/Controller/OrderController.php | 24 ++++++------- .../Controller/PaymentMethodController.php | 15 +++----- .../ORM/Handler/ResourceUpdateHandler.php | 2 +- .../Bundle/CoreBundle/Tests/TestKernel.php | 4 +-- src/Sylius/Bundle/CoreBundle/composer.json | 4 +-- .../Controller/OrderController.php | 36 +++++++++---------- .../Controller/OrderItemController.php | 12 +++---- .../Controller/ProductAttributeController.php | 15 +++----- .../Controller/PromotionCouponController.php | 12 +++---- .../ReviewBundle/test/app/AppKernel.php | 2 +- 12 files changed, 65 insertions(+), 86 deletions(-) diff --git a/.gitignore b/.gitignore index 4ec6a46f36f3..ba3c69676142 100644 --- a/.gitignore +++ b/.gitignore @@ -40,6 +40,7 @@ ###> phpunit/phpunit ### /phpunit.xml +/.phpunit.result.cache ###< phpunit/phpunit ### ###> lexik/jwt-authentication-bundle ### diff --git a/src/Sylius/Bundle/AddressingBundle/Controller/ProvinceController.php b/src/Sylius/Bundle/AddressingBundle/Controller/ProvinceController.php index d8828360635b..dd366b7867e4 100644 --- a/src/Sylius/Bundle/AddressingBundle/Controller/ProvinceController.php +++ b/src/Sylius/Bundle/AddressingBundle/Controller/ProvinceController.php @@ -47,31 +47,31 @@ public function choiceOrTextFieldFormAction(Request $request): Response if (!$country->hasProvinces()) { $form = $this->createProvinceTextForm(); - $view = View::create() - ->setData([ + $content = $this->renderView( + $configuration->getTemplate('_provinceText.html'), + [ 'metadata' => $this->metadata, 'form' => $form->createView(), - ]) - ->setTemplate($configuration->getTemplate('_provinceText.html')) - ; + ] + ); return new JsonResponse([ - 'content' => $this->viewHandler->handle($configuration, $view)->getContent(), + 'content' => $content, ]); } $form = $this->createProvinceChoiceForm($country); - $view = View::create() - ->setData([ + $content = $this->renderView( + $configuration->getTemplate('_provinceChoice.html'), + [ 'metadata' => $this->metadata, 'form' => $form->createView(), - ]) - ->setTemplate($configuration->getTemplate('_provinceChoice.html')) - ; + ] + ); return new JsonResponse([ - 'content' => $this->viewHandler->handle($configuration, $view)->getContent(), + 'content' => $content, ]); } diff --git a/src/Sylius/Bundle/CoreBundle/Controller/OrderController.php b/src/Sylius/Bundle/CoreBundle/Controller/OrderController.php index 152395567cc1..c5d050322e93 100644 --- a/src/Sylius/Bundle/CoreBundle/Controller/OrderController.php +++ b/src/Sylius/Bundle/CoreBundle/Controller/OrderController.php @@ -41,15 +41,13 @@ public function summaryAction(Request $request): Response $form = $this->resourceFormFactory->create($configuration, $cart); - $view = View::create() - ->setTemplate($configuration->getTemplate('summary.html')) - ->setData([ + return $this->render( + $configuration->getTemplate('summary.html'), + [ 'cart' => $cart, 'form' => $form->createView(), - ]) - ; - - return $this->viewHandler->handle($configuration, $view); + ] + ); } public function thankYouAction(Request $request): Response @@ -72,13 +70,11 @@ public function thankYouAction(Request $request): Response $order = $this->repository->find($orderId); Assert::notNull($order); - $view = View::create() - ->setData([ + return $this->render( + $configuration->getParameters()->get('template'), + [ 'order' => $order, - ]) - ->setTemplate($configuration->getParameters()->get('template')) - ; - - return $this->viewHandler->handle($configuration, $view); + ] + ); } } diff --git a/src/Sylius/Bundle/CoreBundle/Controller/PaymentMethodController.php b/src/Sylius/Bundle/CoreBundle/Controller/PaymentMethodController.php index 4ba6c5e7ca20..55c1e06a2d3f 100644 --- a/src/Sylius/Bundle/CoreBundle/Controller/PaymentMethodController.php +++ b/src/Sylius/Bundle/CoreBundle/Controller/PaymentMethodController.php @@ -22,17 +22,12 @@ class PaymentMethodController extends ResourceController { public function getPaymentGatewaysAction(Request $request, string $template): Response { - $configuration = $this->requestConfigurationFactory->create($this->metadata, $request); - - $view = View::create() - ->setTemplate($template) - ->setTemplateVar($this->metadata->getPluralName()) - ->setData([ + return $this->render( + $template, + [ 'gatewayFactories' => $this->getParameter('sylius.gateway_factories'), 'metadata' => $this->metadata, - ]) - ; - - return $this->viewHandler->handle($configuration, $view); + ] + ); } } diff --git a/src/Sylius/Bundle/CoreBundle/Doctrine/ORM/Handler/ResourceUpdateHandler.php b/src/Sylius/Bundle/CoreBundle/Doctrine/ORM/Handler/ResourceUpdateHandler.php index 42cdf6f7d438..d65eb7fa5826 100644 --- a/src/Sylius/Bundle/CoreBundle/Doctrine/ORM/Handler/ResourceUpdateHandler.php +++ b/src/Sylius/Bundle/CoreBundle/Doctrine/ORM/Handler/ResourceUpdateHandler.php @@ -13,7 +13,7 @@ namespace Sylius\Bundle\CoreBundle\Doctrine\ORM\Handler; -use Doctrine\Common\Persistence\ObjectManager; +use Doctrine\Persistence\ObjectManager; use Doctrine\ORM\OptimisticLockException; use Sylius\Bundle\ResourceBundle\Controller\RequestConfiguration; use Sylius\Bundle\ResourceBundle\Controller\ResourceUpdateHandlerInterface; diff --git a/src/Sylius/Bundle/CoreBundle/Tests/TestKernel.php b/src/Sylius/Bundle/CoreBundle/Tests/TestKernel.php index 21e93ec8e983..e3ea1f58c8ab 100644 --- a/src/Sylius/Bundle/CoreBundle/Tests/TestKernel.php +++ b/src/Sylius/Bundle/CoreBundle/Tests/TestKernel.php @@ -4,6 +4,7 @@ namespace Sylius\Bundle\CoreBundle\Tests; +use BabDev\PagerfantaBundle\BabDevPagerfantaBundle; use Bazinga\Bundle\HateoasBundle\BazingaHateoasBundle; use Doctrine\Bundle\DoctrineBundle\DoctrineBundle; use Doctrine\Bundle\DoctrineCacheBundle\DoctrineCacheBundle; @@ -50,7 +51,6 @@ use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\HttpKernel\Kernel as BaseKernel; use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator; -use WhiteOctober\PagerfantaBundle\WhiteOctoberPagerfantaBundle; use winzou\Bundle\StateMachineBundle\winzouStateMachineBundle; final class TestKernel extends BaseKernel @@ -96,7 +96,7 @@ public function registerBundles(): array new LiipImagineBundle(), new PayumBundle(), new StofDoctrineExtensionsBundle(), - new WhiteOctoberPagerfantaBundle(), + new BabDevPagerfantaBundle(), new SyliusFixturesBundle(), new SyliusPayumBundle(), new SyliusThemeBundle(), diff --git a/src/Sylius/Bundle/CoreBundle/composer.json b/src/Sylius/Bundle/CoreBundle/composer.json index d1e231ba4855..0a6ac360b7c4 100644 --- a/src/Sylius/Bundle/CoreBundle/composer.json +++ b/src/Sylius/Bundle/CoreBundle/composer.json @@ -43,7 +43,7 @@ "sylius/currency-bundle": "^1.6", "sylius/customer-bundle": "^1.6", "sylius/fixtures-bundle": "^1.6.1", - "sylius/grid-bundle": "^1.6", + "sylius/grid-bundle": "dev-master", "sylius/inventory-bundle": "^1.6", "sylius/locale-bundle": "^1.6", "sylius/money-bundle": "^1.6", @@ -52,7 +52,7 @@ "sylius/payum-bundle": "^1.6", "sylius/product-bundle": "^1.6", "sylius/promotion-bundle": "^1.6", - "sylius/resource-bundle": "^1.6", + "sylius/resource-bundle": "dev-master", "sylius/review-bundle": "^1.6", "sylius/shipping-bundle": "^1.6", "sylius/taxation-bundle": "^1.6", diff --git a/src/Sylius/Bundle/OrderBundle/Controller/OrderController.php b/src/Sylius/Bundle/OrderBundle/Controller/OrderController.php index f80cbb338dfb..1d391440aff1 100644 --- a/src/Sylius/Bundle/OrderBundle/Controller/OrderController.php +++ b/src/Sylius/Bundle/OrderBundle/Controller/OrderController.php @@ -44,15 +44,13 @@ public function summaryAction(Request $request): Response $form = $this->resourceFormFactory->create($configuration, $cart); - $view = View::create() - ->setTemplate($configuration->getTemplate('summary.html')) - ->setData([ + return $this->render( + $configuration->getTemplate('summary.html'), + [ 'cart' => $cart, 'form' => $form->createView(), - ]) - ; - - return $this->viewHandler->handle($configuration, $view); + ] + ); } public function widgetAction(Request $request): Response @@ -65,12 +63,12 @@ public function widgetAction(Request $request): Response return $this->viewHandler->handle($configuration, View::create($cart)); } - $view = View::create() - ->setTemplate($configuration->getTemplate('summary.html')) - ->setData(['cart' => $cart]) - ; - - return $this->viewHandler->handle($configuration, $view); + return $this->render( + $configuration->getTemplate('summary.html'), + [ + 'cart' => $cart, + ] + ); } public function saveAction(Request $request): Response @@ -118,17 +116,15 @@ public function saveAction(Request $request): Response return $this->viewHandler->handle($configuration, View::create($form, Response::HTTP_BAD_REQUEST)); } - $view = View::create() - ->setData([ + return $this->render( + $configuration->getTemplate(ResourceActions::UPDATE . '.html'), + [ 'configuration' => $configuration, $this->metadata->getName() => $resource, 'form' => $form->createView(), 'cart' => $resource, - ]) - ->setTemplate($configuration->getTemplate(ResourceActions::UPDATE . '.html')) - ; - - return $this->viewHandler->handle($configuration, $view); + ] + ); } public function clearAction(Request $request): Response diff --git a/src/Sylius/Bundle/OrderBundle/Controller/OrderItemController.php b/src/Sylius/Bundle/OrderBundle/Controller/OrderItemController.php index babbe1c82ad0..66627ba03737 100644 --- a/src/Sylius/Bundle/OrderBundle/Controller/OrderItemController.php +++ b/src/Sylius/Bundle/OrderBundle/Controller/OrderItemController.php @@ -97,16 +97,14 @@ public function addAction(Request $request): Response return $this->handleBadAjaxRequestView($configuration, $form); } - $view = View::create() - ->setData([ + return $this->render( + $configuration->getTemplate(CartActions::ADD . '.html'), + [ 'configuration' => $configuration, $this->metadata->getName() => $orderItem, 'form' => $form->createView(), - ]) - ->setTemplate($configuration->getTemplate(CartActions::ADD . '.html')) - ; - - return $this->viewHandler->handle($configuration, $view); + ] + ); } public function removeAction(Request $request): Response diff --git a/src/Sylius/Bundle/ProductBundle/Controller/ProductAttributeController.php b/src/Sylius/Bundle/ProductBundle/Controller/ProductAttributeController.php index 8369a9da8c91..edcc83d35b0b 100644 --- a/src/Sylius/Bundle/ProductBundle/Controller/ProductAttributeController.php +++ b/src/Sylius/Bundle/ProductBundle/Controller/ProductAttributeController.php @@ -26,18 +26,13 @@ class ProductAttributeController extends ResourceController { public function getAttributeTypesAction(Request $request, string $template): Response { - $configuration = $this->requestConfigurationFactory->create($this->metadata, $request); - - $view = View::create() - ->setTemplate($template) - ->setTemplateVar($this->metadata->getPluralName()) - ->setData([ + return $this->render( + $template, + [ 'types' => $this->get('sylius.registry.attribute_type')->all(), 'metadata' => $this->metadata, - ]) - ; - - return $this->viewHandler->handle($configuration, $view); + ] + ); } public function renderAttributesAction(Request $request): Response diff --git a/src/Sylius/Bundle/PromotionBundle/Controller/PromotionCouponController.php b/src/Sylius/Bundle/PromotionBundle/Controller/PromotionCouponController.php index 66c88683baa4..4e29368250e2 100644 --- a/src/Sylius/Bundle/PromotionBundle/Controller/PromotionCouponController.php +++ b/src/Sylius/Bundle/PromotionBundle/Controller/PromotionCouponController.php @@ -52,17 +52,15 @@ public function generateAction(Request $request): Response return $this->viewHandler->handle($configuration, View::create($form)); } - $view = View::create() - ->setTemplate($configuration->getTemplate('generate.html')) - ->setData([ + return $this->render( + $configuration->getTemplate('generate.html'), + [ 'configuration' => $configuration, 'metadata' => $this->metadata, 'promotion' => $promotion, 'form' => $form->createView(), - ]) - ; - - return $this->viewHandler->handle($configuration, $view); + ] + ); } protected function getGenerator(): PromotionCouponGeneratorInterface diff --git a/src/Sylius/Bundle/ReviewBundle/test/app/AppKernel.php b/src/Sylius/Bundle/ReviewBundle/test/app/AppKernel.php index 08b9169aae4e..bf89fcdd47f9 100644 --- a/src/Sylius/Bundle/ReviewBundle/test/app/AppKernel.php +++ b/src/Sylius/Bundle/ReviewBundle/test/app/AppKernel.php @@ -26,7 +26,7 @@ public function registerBundles(): array new FOS\RestBundle\FOSRestBundle(), new JMS\SerializerBundle\JMSSerializerBundle(), new Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle(), - new WhiteOctober\PagerfantaBundle\WhiteOctoberPagerfantaBundle(), + new BabDev\PagerfantaBundle\BabDevPagerfantaBundle(), new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(), new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(), new Sylius\Bundle\UserBundle\SyliusUserBundle(),