From 333b54fc26d949ed9284d1a2a26789497ae197fb Mon Sep 17 00:00:00 2001 From: janpalen Date: Wed, 2 Oct 2024 14:54:09 +0200 Subject: [PATCH 1/6] OP-554 - Add support for Sylius 2.0 --- composer.json | 24 ++-- tests/Application/Kernel.php | 6 - tests/Application/config/bundles.php | 10 +- .../Application/config/packages/security.yaml | 120 ++++++++++++++++++ .../Application/public/media/image/.gitignore | 0 5 files changed, 142 insertions(+), 18 deletions(-) create mode 100644 tests/Application/config/packages/security.yaml delete mode 100644 tests/Application/public/media/image/.gitignore diff --git a/composer.json b/composer.json index f515302..750369f 100644 --- a/composer.json +++ b/composer.json @@ -5,10 +5,16 @@ "description": "CrossSelling plugin for Sylius applications.", "license": "MIT", "require": { - "php": "^8.0", - "friendsofsymfony/elastica-bundle": "^6.0", - "sylius/sylius": "~1.12.0 || ~1.13.0", - "symfony/webpack-encore-bundle": "^1.16" + "php": "^8.1", + "friendsofsymfony/elastica-bundle": "^6.4", + "sylius/grid-bundle": "^1.13@alpha", + "sylius/sylius": "~v2.0.0-alpha.2", + "sylius/twig-hooks": "^0.3.0", + "symfony/ux-autocomplete": "^2.17", + "symfony/ux-live-component": "^2.20", + "symfony/ux-twig-component": "^2.20", + "symfony/webpack-encore-bundle": "^2.1", + "symfony/stimulus-bundle": "^2.12" }, "require-dev": { "behat/behat": "^3.7", @@ -33,11 +39,11 @@ "phpstan/phpstan-webmozart-assert": "^1.2.0", "phpunit/phpunit": "^9.5", "sylius-labs/coding-standard": "^4.0", - "symfony/browser-kit": "^5.4 || ^6.0", - "symfony/debug-bundle": "^5.4 || ^6.0", - "symfony/dotenv": "^5.4 || ^6.0", - "symfony/intl": "^5.4 || ^6.0", - "symfony/web-profiler-bundle": "^5.4 || ^6.0", + "symfony/browser-kit": "^6.4", + "symfony/debug-bundle": "^6.4", + "symfony/dotenv": "^6.4", + "symfony/intl": "^6.4", + "symfony/web-profiler-bundle": "^6.4", "polishsymfonycommunity/symfony-mocker-container": "^1.0" }, "conflict": { diff --git a/tests/Application/Kernel.php b/tests/Application/Kernel.php index 6efc452..f089965 100644 --- a/tests/Application/Kernel.php +++ b/tests/Application/Kernel.php @@ -5,7 +5,6 @@ namespace Tests\BitBag\SyliusCrossSellingPlugin\Application; use PSS\SymfonyMockerContainer\DependencyInjection\MockerContainer; -use Sylius\Bundle\CoreBundle\Application\Kernel as SyliusKernel; use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait; use Symfony\Component\Config\Loader\LoaderInterface; use Symfony\Component\Config\Resource\FileResource; @@ -13,7 +12,6 @@ use Symfony\Component\HttpKernel\Bundle\BundleInterface; use Symfony\Component\HttpKernel\Kernel as BaseKernel; use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator; -use Symfony\Component\Routing\RouteCollectionBuilder; final class Kernel extends BaseKernel { @@ -114,10 +112,6 @@ private function registerBundlesFromFile(string $bundlesFile): iterable private function getConfigurationDirectories(): iterable { yield $this->getProjectDir() . '/config'; - $syliusConfigDir = $this->getProjectDir() . '/config/sylius/' . SyliusKernel::MAJOR_VERSION . '.' . SyliusKernel::MINOR_VERSION; - if (is_dir($syliusConfigDir)) { - yield $syliusConfigDir; - } $symfonyConfigDir = $this->getProjectDir() . '/config/symfony/' . BaseKernel::MAJOR_VERSION . '.' . BaseKernel::MINOR_VERSION; if (is_dir($symfonyConfigDir)) { yield $symfonyConfigDir; diff --git a/tests/Application/config/bundles.php b/tests/Application/config/bundles.php index 76bf623..2c93322 100644 --- a/tests/Application/config/bundles.php +++ b/tests/Application/config/bundles.php @@ -51,14 +51,18 @@ Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => true, 'test' => true, 'test_cached' => true], FriendsOfBehat\SymfonyExtension\Bundle\FriendsOfBehatSymfonyExtensionBundle::class => ['test' => true, 'test_cached' => true], Sylius\Behat\Application\SyliusTestPlugin\SyliusTestPlugin::class => ['test' => true, 'test_cached' => true], - ApiPlatform\Core\Bridge\Symfony\Bundle\ApiPlatformBundle::class => ['all' => true], + ApiPlatform\Symfony\Bundle\ApiPlatformBundle::class => ['all' => true], Lexik\Bundle\JWTAuthenticationBundle\LexikJWTAuthenticationBundle::class => ['all' => true], Sylius\Bundle\ApiBundle\SyliusApiBundle::class => ['all' => true], SyliusLabs\DoctrineMigrationsExtraBundle\SyliusLabsDoctrineMigrationsExtraBundle::class => ['all' => true], FOS\ElasticaBundle\FOSElasticaBundle::class => ['all' => true], Symfony\WebpackEncoreBundle\WebpackEncoreBundle::class => ['all' => true], League\FlysystemBundle\FlysystemBundle::class =>['all' => true], - Sylius\Calendar\SyliusCalendarBundle::class => ['all' => true], - SyliusLabs\Polyfill\Symfony\Security\Bundle\SyliusLabsPolyfillSymfonySecurityBundle::class => ['all' => true], BabDev\PagerfantaBundle\BabDevPagerfantaBundle::class => ['all' => true], + Sylius\Abstraction\StateMachine\SyliusStateMachineAbstractionBundle::class => ['all' => true], + Sylius\TwigHooks\TwigHooksBundle::class => ['all' => true], + Symfony\UX\TwigComponent\TwigComponentBundle::class => ['all' => true], + Symfony\UX\LiveComponent\LiveComponentBundle::class => ['all' => true], + Symfony\UX\Autocomplete\AutocompleteBundle::class => ['all' => true], + Symfony\UX\StimulusBundle\StimulusBundle::class => ['all' => true], ]; diff --git a/tests/Application/config/packages/security.yaml b/tests/Application/config/packages/security.yaml new file mode 100644 index 0000000..31f49cd --- /dev/null +++ b/tests/Application/config/packages/security.yaml @@ -0,0 +1,120 @@ +security: + providers: + sylius_admin_user_provider: + id: sylius.admin_user_provider.email_or_name_based + sylius_api_admin_user_provider: + id: sylius.admin_user_provider.email_or_name_based + sylius_shop_user_provider: + id: sylius.shop_user_provider.email_or_name_based + sylius_api_shop_user_provider: + id: sylius.shop_user_provider.email_or_name_based + + password_hashers: + Sylius\Component\User\Model\UserInterface: argon2i + firewalls: + admin: + switch_user: true + context: admin + pattern: "%sylius.security.admin_regex%" + provider: sylius_admin_user_provider + form_login: + provider: sylius_admin_user_provider + login_path: sylius_admin_login + check_path: sylius_admin_login_check + failure_path: sylius_admin_login + default_target_path: sylius_admin_dashboard + use_forward: false + use_referer: true + enable_csrf: true + csrf_parameter: _csrf_admin_security_token + csrf_token_id: admin_authenticate + remember_me: + secret: "%env(APP_SECRET)%" + path: "/%sylius_admin.path_name%" + name: APP_ADMIN_REMEMBER_ME + lifetime: 31536000 + remember_me_parameter: _remember_me + logout: + path: sylius_admin_logout + target: sylius_admin_login + + new_api_admin_user: + pattern: "%sylius.security.new_api_admin_regex%/.*" + provider: sylius_api_admin_user_provider + stateless: true + entry_point: jwt + json_login: + check_path: "%sylius.security.new_api_admin_route%/administrators/token" + username_path: email + password_path: password + success_handler: lexik_jwt_authentication.handler.authentication_success + failure_handler: lexik_jwt_authentication.handler.authentication_failure + jwt: true + + new_api_shop_user: + pattern: "%sylius.security.new_api_shop_regex%/.*" + provider: sylius_api_shop_user_provider + stateless: true + entry_point: jwt + json_login: + check_path: "%sylius.security.new_api_shop_route%/customers/token" + username_path: email + password_path: password + success_handler: lexik_jwt_authentication.handler.authentication_success + failure_handler: lexik_jwt_authentication.handler.authentication_failure + jwt: true + + shop: + switch_user: { role: ROLE_ALLOWED_TO_SWITCH } + context: shop + pattern: "%sylius.security.shop_regex%" + provider: sylius_shop_user_provider + form_login: + success_handler: sylius.authentication.success_handler + failure_handler: sylius.authentication.failure_handler + provider: sylius_shop_user_provider + login_path: sylius_shop_login + check_path: sylius_shop_login_check + failure_path: sylius_shop_login + default_target_path: sylius_shop_homepage + use_forward: false + use_referer: true + enable_csrf: true + csrf_parameter: _csrf_shop_security_token + csrf_token_id: shop_authenticate + remember_me: + secret: "%env(APP_SECRET)%" + name: APP_SHOP_REMEMBER_ME + lifetime: 31536000 + remember_me_parameter: _remember_me + logout: + path: sylius_shop_logout + target: sylius_shop_homepage + invalidate_session: false + + image_resolver: + pattern: ^/media/cache/resolve + security: false + + dev: + pattern: ^/(_(profiler|wdt)|css|images|js)/ + security: false + + access_control: + - { path: "%sylius.security.admin_regex%/forgotten-password", role: PUBLIC_ACCESS } + + - { path: "%sylius.security.admin_regex%/login", role: PUBLIC_ACCESS } + - { path: "%sylius.security.shop_regex%/login", role: PUBLIC_ACCESS } + + - { path: "%sylius.security.shop_regex%/register", role: PUBLIC_ACCESS } + - { path: "%sylius.security.shop_regex%/verify", role: PUBLIC_ACCESS } + + - { path: "%sylius.security.admin_regex%", role: ROLE_ADMINISTRATION_ACCESS } + - { path: "%sylius.security.shop_regex%/account", role: ROLE_USER } + + - { path: "%sylius.security.new_api_admin_route%/administrators/reset-password", role: PUBLIC_ACCESS } + - { path: "%sylius.security.new_api_admin_regex%/.*", role: ROLE_API_ACCESS } + - { path: "%sylius.security.new_api_admin_route%/administrators/token", role: PUBLIC_ACCESS } + - { path: "%sylius.security.new_api_user_account_regex%/.*", role: ROLE_USER } + - { path: "%sylius.security.new_api_shop_route%/customers/token", role: PUBLIC_ACCESS } + - { path: "%sylius.security.new_api_shop_regex%/.*", role: PUBLIC_ACCESS } diff --git a/tests/Application/public/media/image/.gitignore b/tests/Application/public/media/image/.gitignore deleted file mode 100644 index e69de29..0000000 From daf0599746b762a86907cb99f0d3104b94691f90 Mon Sep 17 00:00:00 2001 From: janpalen Date: Wed, 2 Oct 2024 14:54:44 +0200 Subject: [PATCH 2/6] OP-554 - Refactor webpack and twigs for Sylius 2.0 --- src/Resources/config/config.yaml | 2 +- src/Resources/config/services/twig.xml | 2 +- src/Resources/config/twig_hooks.yaml | 9 +++++++++ src/Resources/config/ui.yaml | 7 ------- .../Shop/Product/_relatedProducts.html.twig | 9 ++++++--- tests/Application/assets/admin/entry.js | 2 +- .../Application/assets/admin/product-entry.js | 1 + tests/Application/assets/controllers.json | 18 ++++++++++++++++++ tests/Application/assets/shop/entry.js | 2 +- .../config/routes/sylius_admin.yaml | 4 ++++ .../Application/config/routes/sylius_shop.yaml | 7 ++++++- tests/Application/config/routes/ux.yaml | 3 +++ tests/Application/package.json | 17 +++++++++++++++-- tests/Application/webpack.config.js | 3 +++ 14 files changed, 69 insertions(+), 17 deletions(-) create mode 100644 src/Resources/config/twig_hooks.yaml delete mode 100644 src/Resources/config/ui.yaml create mode 100644 tests/Application/assets/admin/product-entry.js create mode 100644 tests/Application/assets/controllers.json create mode 100644 tests/Application/config/routes/ux.yaml diff --git a/src/Resources/config/config.yaml b/src/Resources/config/config.yaml index 2dc3103..804214d 100644 --- a/src/Resources/config/config.yaml +++ b/src/Resources/config/config.yaml @@ -1,3 +1,3 @@ imports: - { resource: "@BitBagSyliusCrossSellingPlugin/Resources/config/indexes/*" } - - { resource: "@BitBagSyliusCrossSellingPlugin/Resources/config/ui.yaml" } + - { resource: "@BitBagSyliusCrossSellingPlugin/Resources/config/twig_hooks.yaml" } diff --git a/src/Resources/config/services/twig.xml b/src/Resources/config/services/twig.xml index 00e863e..c59aedd 100644 --- a/src/Resources/config/services/twig.xml +++ b/src/Resources/config/services/twig.xml @@ -6,7 +6,7 @@ xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd" > - @SyliusShop/Product/_horizontalList.html.twig + @SyliusShop/shared/product/horizontal_list.html.twig diff --git a/src/Resources/config/twig_hooks.yaml b/src/Resources/config/twig_hooks.yaml new file mode 100644 index 0000000..92caa8b --- /dev/null +++ b/src/Resources/config/twig_hooks.yaml @@ -0,0 +1,9 @@ +twig_hooks: + hooks: + 'sylius_shop.product.show.page.product_listing': + related_products: + template: "@BitBagSyliusCrossSellingPlugin/Shop/Product/_relatedProducts.html.twig" + priority: 15 + associations: + template: "@SyliusShop/product/show/page/product_listing/associations.html.twig" + priority: 10 diff --git a/src/Resources/config/ui.yaml b/src/Resources/config/ui.yaml deleted file mode 100644 index 46ebf62..0000000 --- a/src/Resources/config/ui.yaml +++ /dev/null @@ -1,7 +0,0 @@ -sylius_ui: - events: - sylius.shop.product.show.content: - blocks: - related_products: - template: "@BitBagSyliusCrossSellingPlugin/Shop/Product/_relatedProducts.html.twig" - priority: 15 diff --git a/src/Resources/views/Shop/Product/_relatedProducts.html.twig b/src/Resources/views/Shop/Product/_relatedProducts.html.twig index 7f0d1a8..a57815f 100644 --- a/src/Resources/views/Shop/Product/_relatedProducts.html.twig +++ b/src/Resources/views/Shop/Product/_relatedProducts.html.twig @@ -1,7 +1,10 @@ -

{{ 'bitbag_sylius_crossselling_plugin.ui.related_products'|trans }} -

-{{ bitbag_crossselling_render_related_products(product.slug, 4) }} + +
+ {{ bitbag_crossselling_render_related_products(product.slug, 4) }} +
diff --git a/tests/Application/assets/admin/entry.js b/tests/Application/assets/admin/entry.js index 635f5ac..063df3e 100644 --- a/tests/Application/assets/admin/entry.js +++ b/tests/Application/assets/admin/entry.js @@ -1 +1 @@ -import 'sylius/bundle/AdminBundle/Resources/private/entry'; +import 'sylius/bundle/AdminBundle/Resources/assets/entrypoint'; diff --git a/tests/Application/assets/admin/product-entry.js b/tests/Application/assets/admin/product-entry.js new file mode 100644 index 0000000..eda4835 --- /dev/null +++ b/tests/Application/assets/admin/product-entry.js @@ -0,0 +1 @@ +import 'sylius/bundle/AdminBundle/Resources/assets/scripts/product/attribute-tabs-refresher'; diff --git a/tests/Application/assets/controllers.json b/tests/Application/assets/controllers.json new file mode 100644 index 0000000..3fed998 --- /dev/null +++ b/tests/Application/assets/controllers.json @@ -0,0 +1,18 @@ + +{ + "controllers": { + "@symfony/ux-autocomplete": { + "autocomplete": { + "main": "dist/controller.js", + "webpackMode": "eager", + "fetch": "eager", + "enabled": true, + "autoimport": { + "tom-select/dist/css/tom-select.default.css": false, + "tom-select/dist/css/tom-select.bootstrap5.css": false + } + } + } + }, + "entrypoints": [] +} diff --git a/tests/Application/assets/shop/entry.js b/tests/Application/assets/shop/entry.js index aadc317..dbb7d93 100644 --- a/tests/Application/assets/shop/entry.js +++ b/tests/Application/assets/shop/entry.js @@ -1 +1 @@ -import 'sylius/bundle/ShopBundle/Resources/private/entry'; +import 'sylius/bundle/ShopBundle/Resources/assets/entrypoint'; diff --git a/tests/Application/config/routes/sylius_admin.yaml b/tests/Application/config/routes/sylius_admin.yaml index 1ba48d6..c76c433 100644 --- a/tests/Application/config/routes/sylius_admin.yaml +++ b/tests/Application/config/routes/sylius_admin.yaml @@ -1,3 +1,7 @@ sylius_admin: resource: "@SyliusAdminBundle/Resources/config/routing.yml" prefix: /admin + +live_component: + resource: "@LiveComponentBundle/config/routes.php" + prefix: /_components diff --git a/tests/Application/config/routes/sylius_shop.yaml b/tests/Application/config/routes/sylius_shop.yaml index 92eeae0..9a25274 100644 --- a/tests/Application/config/routes/sylius_shop.yaml +++ b/tests/Application/config/routes/sylius_shop.yaml @@ -11,4 +11,9 @@ sylius_shop_default_locale: path: / methods: [GET] defaults: - _controller: sylius.controller.shop.locale_switch:switchAction + _controller: sylius.controller.shop.locale_switch::switchAction + +live_component: + resource: "@LiveComponentBundle/config/routes.php" + prefix: /_components + diff --git a/tests/Application/config/routes/ux.yaml b/tests/Application/config/routes/ux.yaml new file mode 100644 index 0000000..2a77f55 --- /dev/null +++ b/tests/Application/config/routes/ux.yaml @@ -0,0 +1,3 @@ +live_component: + resource: "@LiveComponentBundle/config/routes.php" + prefix: /_components diff --git a/tests/Application/package.json b/tests/Application/package.json index f188aaa..d2c18b7 100644 --- a/tests/Application/package.json +++ b/tests/Application/package.json @@ -1,7 +1,13 @@ { "dependencies": { "@babel/polyfill": "^7.0.0", + "@popperjs/core": "^2.11.8", + "@tabler/core": "^1.0.0-beta21", + "apexcharts": "^3.53.0", + "bootstrap": "^5.3.3", "chart.js": "^3.7.1", + "flag-icons": "^7.2.3", + "infinite-tree": "^1.18.0", "jquery": "^3.5.0", "jquery.dirtyforms": "^2.0.0", "lightbox2": "^2.9.0", @@ -9,6 +15,10 @@ "slick-carousel": "^1.8.1" }, "devDependencies": { + "@hotwired/stimulus": "^3.2.2", + "@symfony/stimulus-bridge": "^3.2.2", + "@symfony/ux-autocomplete": "file:../../vendor/symfony/ux-autocomplete/assets", + "@symfony/ux-live-component": "file:../../vendor/symfony/ux-live-component/assets", "@symfony/webpack-encore": "^1.6.1", "babel-core": "^6.26.3", "babel-plugin-external-helpers": "^6.22.0", @@ -23,7 +33,10 @@ "eslint-plugin-import": "^2.11.0", "merge-stream": "^1.0.0", "sass": "^1.39.2", - "sass-loader": "^12.1.0" + "sass-loader": "^12.1.0", + "slugify": "^1.6.6", + "stimulus-use": "^0.52.2", + "tom-select": "^2.3.1" }, "scripts": { "dev": "yarn encore dev", @@ -38,4 +51,4 @@ }, "author": "Paweł Jędrzejewski", "license": "MIT" -} \ No newline at end of file +} diff --git a/tests/Application/webpack.config.js b/tests/Application/webpack.config.js index be0fe91..fb42fdc 100644 --- a/tests/Application/webpack.config.js +++ b/tests/Application/webpack.config.js @@ -10,6 +10,7 @@ const uiBundleResources = path.resolve(syliusBundles, 'UiBundle/Resources/privat Encore.setOutputPath('public/build/shop/') .setPublicPath('/build/shop') .addEntry('shop-entry', './assets/shop/entry.js') + .enableStimulusBridge('./assets/controllers.json') .disableSingleRuntimeChunk() .cleanupOutputBeforeBuild() .enableSourceMaps(!Encore.isProduction()) @@ -29,6 +30,8 @@ Encore.reset(); Encore.setOutputPath('public/build/admin/') .setPublicPath('/build/admin') .addEntry('admin-entry', './assets/admin/entry.js') + .addEntry('admin-product-entry', './assets/admin/product-entry.js') + .enableStimulusBridge('./assets/controllers.json') .disableSingleRuntimeChunk() .cleanupOutputBeforeBuild() .enableSourceMaps(!Encore.isProduction()) From de42be18cd2977594c44519c5465cd0f5ff8a564 Mon Sep 17 00:00:00 2001 From: janpalen Date: Thu, 3 Oct 2024 08:42:34 +0200 Subject: [PATCH 3/6] OP-554 - Fix behats --- .github/workflows/build.yml | 15 ++++----------- .github/workflows/coding_standard.yml | 16 ++++------------ composer.json | 16 +++++++++------- .../Shop/Product/_relatedProducts.html.twig | 4 +--- 4 files changed, 18 insertions(+), 33 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3797c1c..833d712 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -20,18 +20,11 @@ jobs: strategy: fail-fast: false matrix: - php: [ "8.0", "8.1", "8.2", "8.3" ] - symfony: [ "^5.4", "^6.4" ] - sylius: [ "~1.12.0", "~1.13.0" ] - node: [ "18.x", "20.x" ] + php: [ "8.2", "8.3" ] + symfony: [ "^6.4", "^7.1" ] + sylius: [ "~v2.0.0-alpha.2" ] + node: [ "20.x" ] mysql: [ "8.0" ] - - exclude: - - sylius: "~1.13.0" - php: "8.0" - - sylius: "~1.12.0" - php: "8.0" - symfony: "^6.4" env: APP_ENV: test diff --git a/.github/workflows/coding_standard.yml b/.github/workflows/coding_standard.yml index 144689b..c64adc1 100644 --- a/.github/workflows/coding_standard.yml +++ b/.github/workflows/coding_standard.yml @@ -18,18 +18,10 @@ jobs: strategy: fail-fast: false matrix: - php: [ "8.0", "8.1", "8.2", "8.3" ] - symfony: [ "^5.4", "^6.4" ] - sylius: [ "^1.12", "^1.13" ] - node: [ "18.x", "20.x" ] - mysql: [ "8.0" ] - - exclude: - - sylius: ^1.13 - php: 8.0 - - sylius: ^1.12 - php: 8.0 - symfony: ^6.4 + php: [ "8.2", "8.3" ] + symfony: [ "^6.4", "^7.1" ] + sylius: [ "~v2.0.0-alpha.2" ] + node: [ "20.x" ] steps: - uses: actions/checkout@v3 diff --git a/composer.json b/composer.json index 750369f..46973fb 100644 --- a/composer.json +++ b/composer.json @@ -5,10 +5,10 @@ "description": "CrossSelling plugin for Sylius applications.", "license": "MIT", "require": { - "php": "^8.1", + "php": "^8.2", "friendsofsymfony/elastica-bundle": "^6.4", "sylius/grid-bundle": "^1.13@alpha", - "sylius/sylius": "~v2.0.0-alpha.2", + "sylius/sylius": "~v2.0.0-alpha.3", "sylius/twig-hooks": "^0.3.0", "symfony/ux-autocomplete": "^2.17", "symfony/ux-live-component": "^2.20", @@ -39,11 +39,13 @@ "phpstan/phpstan-webmozart-assert": "^1.2.0", "phpunit/phpunit": "^9.5", "sylius-labs/coding-standard": "^4.0", - "symfony/browser-kit": "^6.4", - "symfony/debug-bundle": "^6.4", - "symfony/dotenv": "^6.4", - "symfony/intl": "^6.4", - "symfony/web-profiler-bundle": "^6.4", + "sylius/resource": "v1.12@alpha", + "sylius/resource-bundle": "v1.12@alpha", + "symfony/browser-kit": "^6.4 || ^7.1", + "symfony/debug-bundle": "^6.4 || ^7.1", + "symfony/dotenv": "^6.4 || ^7.1", + "symfony/intl": "^6.4 || ^7.1", + "symfony/web-profiler-bundle": "^6.4 || ^7.1", "polishsymfonycommunity/symfony-mocker-container": "^1.0" }, "conflict": { diff --git a/src/Resources/views/Shop/Product/_relatedProducts.html.twig b/src/Resources/views/Shop/Product/_relatedProducts.html.twig index a57815f..7f37249 100644 --- a/src/Resources/views/Shop/Product/_relatedProducts.html.twig +++ b/src/Resources/views/Shop/Product/_relatedProducts.html.twig @@ -5,6 +5,4 @@ > {{ 'bitbag_sylius_crossselling_plugin.ui.related_products'|trans }} -
- {{ bitbag_crossselling_render_related_products(product.slug, 4) }} -
+{{ bitbag_crossselling_render_related_products(product.slug, 4) }} From 12ee80f86eedb7a6f181572a7100a56f57483ccd Mon Sep 17 00:00:00 2001 From: janpalen Date: Thu, 3 Oct 2024 11:58:35 +0200 Subject: [PATCH 4/6] OP-554 - Fixes for Symfony 7 --- composer.json | 6 +- tests/Application/Kernel.php | 2 +- tests/Application/config/bundles.php | 1 - .../config/packages/validator.yaml | 2 +- .../config/sylius/1.12/packages/security.yaml | 122 ----------------- .../config/sylius/1.13/bundles.php | 7 - .../config/sylius/1.13/packages/security.yaml | 124 ------------------ .../config/symfony/6.x/bundles.php | 7 + 8 files changed, 12 insertions(+), 259 deletions(-) delete mode 100644 tests/Application/config/sylius/1.12/packages/security.yaml delete mode 100644 tests/Application/config/sylius/1.13/bundles.php delete mode 100644 tests/Application/config/sylius/1.13/packages/security.yaml create mode 100644 tests/Application/config/symfony/6.x/bundles.php diff --git a/composer.json b/composer.json index 46973fb..72c28ab 100644 --- a/composer.json +++ b/composer.json @@ -8,7 +8,7 @@ "php": "^8.2", "friendsofsymfony/elastica-bundle": "^6.4", "sylius/grid-bundle": "^1.13@alpha", - "sylius/sylius": "~v2.0.0-alpha.3", + "sylius/sylius": "~v2.0.0-alpha.2", "sylius/twig-hooks": "^0.3.0", "symfony/ux-autocomplete": "^2.17", "symfony/ux-live-component": "^2.20", @@ -39,8 +39,8 @@ "phpstan/phpstan-webmozart-assert": "^1.2.0", "phpunit/phpunit": "^9.5", "sylius-labs/coding-standard": "^4.0", - "sylius/resource": "v1.12@alpha", - "sylius/resource-bundle": "v1.12@alpha", + "sylius/resource": "v1.12.x-dev", + "sylius/resource-bundle": "1.12.x-dev", "symfony/browser-kit": "^6.4 || ^7.1", "symfony/debug-bundle": "^6.4 || ^7.1", "symfony/dotenv": "^6.4 || ^7.1", diff --git a/tests/Application/Kernel.php b/tests/Application/Kernel.php index f089965..7fc71ca 100644 --- a/tests/Application/Kernel.php +++ b/tests/Application/Kernel.php @@ -112,7 +112,7 @@ private function registerBundlesFromFile(string $bundlesFile): iterable private function getConfigurationDirectories(): iterable { yield $this->getProjectDir() . '/config'; - $symfonyConfigDir = $this->getProjectDir() . '/config/symfony/' . BaseKernel::MAJOR_VERSION . '.' . BaseKernel::MINOR_VERSION; + $symfonyConfigDir = $this->getProjectDir() . '/config/symfony/' . BaseKernel::MAJOR_VERSION . 'x'; if (is_dir($symfonyConfigDir)) { yield $symfonyConfigDir; } diff --git a/tests/Application/config/bundles.php b/tests/Application/config/bundles.php index 2c93322..e99184d 100644 --- a/tests/Application/config/bundles.php +++ b/tests/Application/config/bundles.php @@ -32,7 +32,6 @@ Sylius\Bundle\GridBundle\SyliusGridBundle::class => ['all' => true], winzou\Bundle\StateMachineBundle\winzouStateMachineBundle::class => ['all' => true], Sonata\BlockBundle\SonataBlockBundle::class => ['all' => true], - Bazinga\Bundle\HateoasBundle\BazingaHateoasBundle::class => ['all' => true], JMS\SerializerBundle\JMSSerializerBundle::class => ['all' => true], FOS\RestBundle\FOSRestBundle::class => ['all' => true], Knp\Bundle\GaufretteBundle\KnpGaufretteBundle::class => ['all' => true], diff --git a/tests/Application/config/packages/validator.yaml b/tests/Application/config/packages/validator.yaml index 61807db..8ff7da1 100644 --- a/tests/Application/config/packages/validator.yaml +++ b/tests/Application/config/packages/validator.yaml @@ -1,3 +1,3 @@ framework: validation: - enable_annotations: true + enable_attributes: true diff --git a/tests/Application/config/sylius/1.12/packages/security.yaml b/tests/Application/config/sylius/1.12/packages/security.yaml deleted file mode 100644 index 71d89cd..0000000 --- a/tests/Application/config/sylius/1.12/packages/security.yaml +++ /dev/null @@ -1,122 +0,0 @@ -security: - enable_authenticator_manager: true - providers: - sylius_admin_user_provider: - id: sylius.admin_user_provider.email_or_name_based - sylius_api_admin_user_provider: - id: sylius.admin_user_provider.email_or_name_based - sylius_shop_user_provider: - id: sylius.shop_user_provider.email_or_name_based - sylius_api_shop_user_provider: - id: sylius.shop_user_provider.email_or_name_based - - password_hashers: - Sylius\Component\User\Model\UserInterface: argon2i - firewalls: - admin: - switch_user: true - context: admin - pattern: "%sylius.security.admin_regex%" - provider: sylius_admin_user_provider - form_login: - provider: sylius_admin_user_provider - login_path: sylius_admin_login - check_path: sylius_admin_login_check - failure_path: sylius_admin_login - default_target_path: sylius_admin_dashboard - use_forward: false - use_referer: true - enable_csrf: true - csrf_parameter: _csrf_admin_security_token - csrf_token_id: admin_authenticate - remember_me: - secret: "%env(APP_SECRET)%" - path: "/%sylius_admin.path_name%" - name: APP_ADMIN_REMEMBER_ME - lifetime: 31536000 - remember_me_parameter: _remember_me - logout: - path: sylius_admin_logout - target: sylius_admin_login - - new_api_admin_user: - pattern: "%sylius.security.new_api_admin_regex%/.*" - provider: sylius_api_admin_user_provider - stateless: true - entry_point: jwt - json_login: - check_path: "%sylius.security.new_api_admin_route%/authentication-token" - username_path: email - password_path: password - success_handler: lexik_jwt_authentication.handler.authentication_success - failure_handler: lexik_jwt_authentication.handler.authentication_failure - jwt: true - - new_api_shop_user: - pattern: "%sylius.security.new_api_shop_regex%/.*" - provider: sylius_api_shop_user_provider - stateless: true - entry_point: jwt - json_login: - check_path: "%sylius.security.new_api_shop_route%/authentication-token" - username_path: email - password_path: password - success_handler: lexik_jwt_authentication.handler.authentication_success - failure_handler: lexik_jwt_authentication.handler.authentication_failure - jwt: true - - shop: - switch_user: { role: ROLE_ALLOWED_TO_SWITCH } - context: shop - pattern: "%sylius.security.shop_regex%" - provider: sylius_shop_user_provider - form_login: - success_handler: sylius.authentication.success_handler - failure_handler: sylius.authentication.failure_handler - provider: sylius_shop_user_provider - login_path: sylius_shop_login - check_path: sylius_shop_login_check - failure_path: sylius_shop_login - default_target_path: sylius_shop_homepage - use_forward: false - use_referer: true - enable_csrf: true - csrf_parameter: _csrf_shop_security_token - csrf_token_id: shop_authenticate - remember_me: - secret: "%env(APP_SECRET)%" - name: APP_SHOP_REMEMBER_ME - lifetime: 31536000 - remember_me_parameter: _remember_me - logout: - path: sylius_shop_logout - target: sylius_shop_homepage - invalidate_session: false - - dev: - pattern: ^/(_(profiler|wdt)|css|images|js)/ - security: false - - access_control: - - { path: "%sylius.security.admin_regex%/_partial", role: PUBLIC_ACCESS, ips: [127.0.0.1, ::1] } - - { path: "%sylius.security.admin_regex%/_partial", role: ROLE_NO_ACCESS } - - { path: "%sylius.security.shop_regex%/_partial", role: PUBLIC_ACCESS, ips: [127.0.0.1, ::1] } - - { path: "%sylius.security.shop_regex%/_partial", role: ROLE_NO_ACCESS } - - - { path: "%sylius.security.admin_regex%/forgotten-password", role: PUBLIC_ACCESS } - - - { path: "%sylius.security.admin_regex%/login", role: PUBLIC_ACCESS } - - { path: "%sylius.security.shop_regex%/login", role: PUBLIC_ACCESS } - - - { path: "%sylius.security.shop_regex%/register", role: PUBLIC_ACCESS } - - { path: "%sylius.security.shop_regex%/verify", role: PUBLIC_ACCESS } - - - { path: "%sylius.security.admin_regex%", role: ROLE_ADMINISTRATION_ACCESS } - - { path: "%sylius.security.shop_regex%/account", role: ROLE_USER } - - - { path: "%sylius.security.new_api_admin_route%/reset-password-requests", role: PUBLIC_ACCESS } - - { path: "%sylius.security.new_api_admin_regex%/.*", role: ROLE_API_ACCESS } - - { path: "%sylius.security.new_api_admin_route%/authentication-token", role: PUBLIC_ACCESS } - - { path: "%sylius.security.new_api_user_account_regex%/.*", role: ROLE_USER } - - { path: "%sylius.security.new_api_shop_route%/authentication-token", role: PUBLIC_ACCESS } - - { path: "%sylius.security.new_api_shop_regex%/.*", role: PUBLIC_ACCESS } diff --git a/tests/Application/config/sylius/1.13/bundles.php b/tests/Application/config/sylius/1.13/bundles.php deleted file mode 100644 index 5d54121..0000000 --- a/tests/Application/config/sylius/1.13/bundles.php +++ /dev/null @@ -1,7 +0,0 @@ - ['all' => true], -]; diff --git a/tests/Application/config/sylius/1.13/packages/security.yaml b/tests/Application/config/sylius/1.13/packages/security.yaml deleted file mode 100644 index 6745ae8..0000000 --- a/tests/Application/config/sylius/1.13/packages/security.yaml +++ /dev/null @@ -1,124 +0,0 @@ -security: - enable_authenticator_manager: true - providers: - sylius_admin_user_provider: - id: sylius.admin_user_provider.email_or_name_based - sylius_api_admin_user_provider: - id: sylius.admin_user_provider.email_or_name_based - sylius_shop_user_provider: - id: sylius.shop_user_provider.email_or_name_based - sylius_api_shop_user_provider: - id: sylius.shop_user_provider.email_or_name_based - - password_hashers: - Sylius\Component\User\Model\UserInterface: argon2i - firewalls: - admin: - switch_user: true - context: admin - pattern: "%sylius.security.admin_regex%" - provider: sylius_admin_user_provider - form_login: - provider: sylius_admin_user_provider - login_path: sylius_admin_login - check_path: sylius_admin_login_check - failure_path: sylius_admin_login - default_target_path: sylius_admin_dashboard - use_forward: false - use_referer: true - enable_csrf: true - csrf_parameter: _csrf_admin_security_token - csrf_token_id: admin_authenticate - remember_me: - secret: "%env(APP_SECRET)%" - path: "/%sylius_admin.path_name%" - name: APP_ADMIN_REMEMBER_ME - lifetime: 31536000 - remember_me_parameter: _remember_me - logout: - path: sylius_admin_logout - target: sylius_admin_login - - new_api_admin_user: - pattern: "%sylius.security.new_api_admin_regex%/.*" - provider: sylius_api_admin_user_provider - stateless: true - entry_point: jwt - json_login: - check_path: "%sylius.security.new_api_admin_route%/administrators/token" - username_path: email - password_path: password - success_handler: lexik_jwt_authentication.handler.authentication_success - failure_handler: lexik_jwt_authentication.handler.authentication_failure - jwt: true - - new_api_shop_user: - pattern: "%sylius.security.new_api_shop_regex%/.*" - provider: sylius_api_shop_user_provider - stateless: true - entry_point: jwt - json_login: - check_path: "%sylius.security.new_api_shop_route%/customers/token" - username_path: email - password_path: password - success_handler: lexik_jwt_authentication.handler.authentication_success - failure_handler: lexik_jwt_authentication.handler.authentication_failure - jwt: true - - shop: - switch_user: { role: ROLE_ALLOWED_TO_SWITCH } - context: shop - pattern: "%sylius.security.shop_regex%" - provider: sylius_shop_user_provider - form_login: - success_handler: sylius.authentication.success_handler - failure_handler: sylius.authentication.failure_handler - provider: sylius_shop_user_provider - login_path: sylius_shop_login - check_path: sylius_shop_login_check - failure_path: sylius_shop_login - default_target_path: sylius_shop_homepage - use_forward: false - use_referer: true - enable_csrf: true - csrf_parameter: _csrf_shop_security_token - csrf_token_id: shop_authenticate - remember_me: - secret: "%env(APP_SECRET)%" - name: APP_SHOP_REMEMBER_ME - lifetime: 31536000 - remember_me_parameter: _remember_me - logout: - path: sylius_shop_logout - target: sylius_shop_homepage - invalidate_session: false - - dev: - pattern: ^/(_(profiler|wdt)|css|images|js)/ - security: false - - image_resolver: - pattern: ^/media/cache/resolve - security: false - - access_control: - - { path: "%sylius.security.admin_regex%/_partial", role: PUBLIC_ACCESS, ips: [127.0.0.1, ::1] } - - { path: "%sylius.security.admin_regex%/_partial", role: ROLE_NO_ACCESS } - - { path: "%sylius.security.shop_regex%/_partial", role: PUBLIC_ACCESS, ips: [127.0.0.1, ::1] } - - { path: "%sylius.security.shop_regex%/_partial", role: ROLE_NO_ACCESS } - - - { path: "%sylius.security.admin_regex%/login", role: PUBLIC_ACCESS } - - { path: "%sylius.security.shop_regex%/login", role: PUBLIC_ACCESS } - - - { path: "%sylius.security.shop_regex%/register", role: PUBLIC_ACCESS } - - { path: "%sylius.security.shop_regex%/verify", role: PUBLIC_ACCESS } - - - { path: "%sylius.security.admin_regex%", role: ROLE_ADMINISTRATION_ACCESS } - - { path: "%sylius.security.shop_regex%/account", role: ROLE_USER } - - - { path: "%sylius.security.new_api_admin_route%/administrators/reset-password", role: PUBLIC_ACCESS } - - { path: "%sylius.security.new_api_admin_regex%/.*", role: ROLE_API_ACCESS } - - { path: "%sylius.security.new_api_admin_route%/administrators/token", role: PUBLIC_ACCESS } - - { path: "%sylius.security.new_api_user_account_regex%/.*", role: ROLE_USER } - - { path: "%sylius.security.new_api_shop_route%/customers/token", role: PUBLIC_ACCESS } - - { path: "%sylius.security.new_api_shop_regex%/.*", role: PUBLIC_ACCESS } \ No newline at end of file diff --git a/tests/Application/config/symfony/6.x/bundles.php b/tests/Application/config/symfony/6.x/bundles.php new file mode 100644 index 0000000..be65844 --- /dev/null +++ b/tests/Application/config/symfony/6.x/bundles.php @@ -0,0 +1,7 @@ + ['all' => true], +]; From e5b9dd5b35cd529f2b7e72f70ad378b0895857e4 Mon Sep 17 00:00:00 2001 From: janpalen Date: Thu, 3 Oct 2024 13:47:45 +0200 Subject: [PATCH 5/6] OP-554 - Change installation.md --- doc/installation.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/doc/installation.md b/doc/installation.md index 208b0e5..2d891c8 100644 --- a/doc/installation.md +++ b/doc/installation.md @@ -16,13 +16,13 @@ ADDITIONAL ## Requirements: We work on stable, supported and up-to-date versions of packages. We recommend you to do the same. -| Package | Version | -|---------------|-----------------| -| PHP | \>=8.0 | -| sylius/sylius | 1.12.x - 1.13.x | -| MySQL | \>= 5.7 | -| NodeJS | \>= 18.x | -| ElasticSearch | \>= 7.x | +| Package | Version | +|---------------|----------| +| PHP | \>=8.2 | +| sylius/sylius | \>=2.0.0 | +| MySQL | \>= 5.7 | +| NodeJS | \>= 20.x | +| ElasticSearch | \>= 7.x | ## Composer: ```bash From 5ccc08b77ff5d562f5b5e0ed6ae4c9a38e581203 Mon Sep 17 00:00:00 2001 From: janpalen Date: Tue, 8 Oct 2024 09:51:14 +0200 Subject: [PATCH 6/6] OP-554 - Change after code review --- composer.json | 4 ++-- tests/Application/assets/controllers.json | 1 - tests/Application/config/bootstrap.php | 7 +++++++ tests/Application/config/bundles.php | 7 +++++++ tests/Application/config/routes/sylius_shop.yaml | 1 - tests/Application/config/symfony/6.x/bundles.php | 7 +++++++ 6 files changed, 23 insertions(+), 4 deletions(-) diff --git a/composer.json b/composer.json index 72c28ab..f6c3d00 100644 --- a/composer.json +++ b/composer.json @@ -8,6 +8,8 @@ "php": "^8.2", "friendsofsymfony/elastica-bundle": "^6.4", "sylius/grid-bundle": "^1.13@alpha", + "sylius/resource": "v1.12.x-dev", + "sylius/resource-bundle": "1.12.x-dev", "sylius/sylius": "~v2.0.0-alpha.2", "sylius/twig-hooks": "^0.3.0", "symfony/ux-autocomplete": "^2.17", @@ -39,8 +41,6 @@ "phpstan/phpstan-webmozart-assert": "^1.2.0", "phpunit/phpunit": "^9.5", "sylius-labs/coding-standard": "^4.0", - "sylius/resource": "v1.12.x-dev", - "sylius/resource-bundle": "1.12.x-dev", "symfony/browser-kit": "^6.4 || ^7.1", "symfony/debug-bundle": "^6.4 || ^7.1", "symfony/dotenv": "^6.4 || ^7.1", diff --git a/tests/Application/assets/controllers.json b/tests/Application/assets/controllers.json index 3fed998..8428b1f 100644 --- a/tests/Application/assets/controllers.json +++ b/tests/Application/assets/controllers.json @@ -1,4 +1,3 @@ - { "controllers": { "@symfony/ux-autocomplete": { diff --git a/tests/Application/config/bootstrap.php b/tests/Application/config/bootstrap.php index 2291ab4..450a654 100644 --- a/tests/Application/config/bootstrap.php +++ b/tests/Application/config/bootstrap.php @@ -1,5 +1,12 @@