From 9d41645e037e142c8b63cb172c645cc5882cd5f7 Mon Sep 17 00:00:00 2001 From: Luca Gallinari Date: Mon, 27 Jul 2026 16:26:05 +0200 Subject: [PATCH 01/14] [Sylius 2] Update composer dependencies to Sylius 2.x / Symfony 7 / PHP 8.2 Bumps sylius/sylius to ~2.2.0, php to ^8.2, drops the obsolete doctrine/dbal ^3.0 conflict and the abandoned friendsofsymfony/jsrouting-bundle (incompatible with Symfony 7), and aligns dev tooling (phpstan, phpspec, phpunit, psalm, sylius-labs/coding-standard, sylius/test-application) with current Sylius 2.x versions. --- .gitignore | 4 +- bin/create_console_symlink.php | 53 ++++++++++++++ composer.json | 125 +++++++++++++++++++++++---------- 3 files changed, 143 insertions(+), 39 deletions(-) create mode 100644 bin/create_console_symlink.php diff --git a/.gitignore b/.gitignore index 2fba55ec9..da7068c99 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ /bin/* !/bin/.gitkeep +!/bin/create_console_symlink.php /vendor/ /node_modules/ @@ -8,8 +9,9 @@ /etc/build/* !/etc/build/.gitkeep -/tests/Application/yarn.lock +/var/ /web/media /.phpunit.result.cache +/.php-version diff --git a/bin/create_console_symlink.php b/bin/create_console_symlink.php new file mode 100644 index 000000000..9dbf03cb1 --- /dev/null +++ b/bin/create_console_symlink.php @@ -0,0 +1,53 @@ + {$targetRelativeFromBin}"); +} + +@chmod($linkPath, 0755); +info("Created symlink: bin/console -> {$targetRelativeFromBin}"); diff --git a/composer.json b/composer.json index 4047626fd..247a78695 100644 --- a/composer.json +++ b/composer.json @@ -19,59 +19,108 @@ } ], "require": { - "php": "^8.0", - - "sylius/sylius": "~1.10.11 || ~1.11.2", - "friendsofsymfony/jsrouting-bundle": "^2.2" + "php": "^8.2", + "sylius/sylius": "~2.2.0" }, "require-dev": { - "behat/behat": "^3.6", - "behat/mink-selenium2-driver": "^1.4", - "dmore/behat-chrome-extension": "^1.3", - "dmore/chrome-mink-driver": "^2.7", - "friends-of-behat/mink": "^1.8", - "friends-of-behat/mink-browserkit-driver": "^1.3", - "friends-of-behat/mink-extension": "^2.5", + "behat/behat": "^3.16", + "behat/mink": "^1.13", + "behat/mink-selenium2-driver": "^1.7", + "dbrekelmans/bdi": "^1.4", + "dmore/behat-chrome-extension": "^1.4", + "dmore/chrome-mink-driver": "^2.9", + "friends-of-behat/mink-browserkit-driver": "^1.6", + "friends-of-behat/mink-debug-extension": "^2.1", + "friends-of-behat/mink-extension": "^2.7", "friends-of-behat/page-object-extension": "^0.3", - "friends-of-behat/suite-settings-extension": "^1.0", - "friends-of-behat/symfony-extension": "^2.1", - "friends-of-behat/variadic-extension": "^1.3", - "friends-of-behat/mink-debug-extension": "^2.0", - "friendsofsymfony/oauth-server-bundle": "^1.6 || >2.0.0-alpha.0 ^2.0@dev", - "phpspec/phpspec": "^7.0", - "phpstan/phpstan": "0.12.96", - "phpstan/phpstan-webmozart-assert": "0.12.12", - "phpunit/phpunit": "^9.5", + "friends-of-behat/suite-settings-extension": "^1.1", + "friends-of-behat/symfony-extension": "^2.6", + "friends-of-behat/variadic-extension": "^1.6", + "phpspec/phpspec": "^8.0", + "phpstan/phpstan": "^1.12", + "phpstan/phpstan-webmozart-assert": "^1.2", + "phpunit/phpunit": "^10.5", "polishsymfonycommunity/symfony-mocker-container": "^1.0", - "se/selenium-server-standalone": "^2.52", - "sylius-labs/coding-standard": "^3.0", - "symfony/debug-bundle": "^4.4 || ^5.4", - "symfony/dotenv": "^4.4 || ^5.4", - "symfony/web-profiler-bundle": "^4.4 || ^5.4" - }, - "conflict": { - "doctrine/dbal": "^3.0" + "psalm/plugin-symfony": "^5.2", + "rector/rector": "^1.0", + "sylius-labs/coding-standard": "^4.4", + "sylius/sylius-rector": "^2.0", + "sylius/test-application": "^2.0.0@alpha", + "symfony/debug-bundle": "^7.1", + "symfony/dotenv": "^7.1", + "symfony/web-profiler-bundle": "^7.1", + "symfony/webpack-encore-bundle": "^2.2", + "vimeo/psalm": "^6.13" }, "prefer-stable": true, + "config": { + "sort-packages": true, + "allow-plugins": { + "dealerdirect/phpcodesniffer-composer-installer": false, + "php-http/discovery": false, + "symfony/flex": true, + "symfony/runtime": true + } + }, "autoload": { "psr-4": { - "Sylius\\AdminOrderCreationPlugin\\": "src/", - "Tests\\Sylius\\AdminOrderCreationPlugin\\": "tests/" + "Sylius\\AdminOrderCreationPlugin\\": "src/" + } + }, + "autoload-dev": { + "psr-4": { + "Tests\\Sylius\\AdminOrderCreationPlugin\\": ["tests/", "tests/TestApplication/src/"] } }, "scripts": { - "analyse": [ - "@composer validate --strict", - "vendor/bin/phpstan analyse -c phpstan.neon -l max src/", - "vendor/bin/ecs check src/ spec/" + "database-reset": [ + "vendor/bin/console doctrine:database:drop --force --if-exists", + "vendor/bin/console doctrine:database:create", + "vendor/bin/console doctrine:migration:migrate -n", + "vendor/bin/console sylius:fixtures:load -n" + ], + "frontend-clear": [ + "cd vendor/sylius/test-application && yarn install && yarn build", + "vendor/bin/console assets:install" + ], + "test-app-init": [ + "@database-reset", + "@frontend-clear" ], - "fix": [ - "vendor/bin/ecs check src/ spec/ --fix" + "ecs": "ecs", + "phpstan": "phpstan analyse", + "psalm": "psalm --no-cache", + "phpunit": "phpunit", + "phpspec": "phpspec run", + "behat": "behat --strict -vvv --no-interaction || behat --strict -vvv --no-interaction --rerun", + "suite": [ + "@ecs", + "@phpstan", + "@psalm", + "@phpunit", + "@phpspec", + "@behat" + ], + "auto-scripts": { + "security-checker security:check": "script" + }, + "post-install-cmd": [ + "@create-console-symlink" + ], + "post-update-cmd": [ + "@create-console-symlink" + ], + "create-console-symlink": [ + "@php bin/create_console_symlink.php" ] }, "extra": { "branch-alias": { - "dev-master": "1.1-dev" - } + "dev-master": "2.0-dev" + }, + "symfony": { + "require": "^7.3" + }, + "public-dir": "vendor/sylius/test-application/public" } } From 31520ec335ed4dd929deba87ecbbeb5e37700350 Mon Sep 17 00:00:00 2001 From: Luca Gallinari Date: Mon, 27 Jul 2026 16:26:33 +0200 Subject: [PATCH 02/14] [Sylius 2] Move src/Resources/* to flat config/, templates/, translations/ Aligns with the Sylius 2.x plugin layout: config/app/*.yml -> config/*.yaml, views/* -> templates/* (snake_case), translations/*.yml -> translations/*.yaml. Overrides Bundle::getPath() to point at the plugin root so Symfony resolves the new top-level directories instead of the legacy Resources/ convention, and updates every internal template/config path reference accordingly (controllers, routing, DI extension, README install/copy instructions). --- README.md | 36 ++++++++--- .../config/app/ajax.yml => config/ajax.yaml | 8 +-- .../app/config.yml => config/config.yaml | 4 +- .../app/routing.yml => config/routing.yaml | 17 +++--- {src/Resources/config => config}/services.xml | 4 +- .../services/reorder_processing.xml | 4 +- docs/legacy_installation.md | 61 ------------------- src/Controller/OrderCreateAction.php | 4 +- src/Controller/OrderPreviewAction.php | 4 +- .../SelectNewOrderCustomerAction.php | 2 +- .../SyliusAdminOrderCreationExtension.php | 4 +- src/SyliusAdminOrderCreationPlugin.php | 5 ++ .../Order/Show/Summary/_item.html.twig | 0 .../Order/Show/Summary/_totals.html.twig | 0 .../Order/Show/_payment.html.twig | 0 .../emails/order_created.html.twig | 0 .../order}/create.html.twig | 17 +++--- .../order/create}/_breadcrumb.html.twig | 0 .../order/create}/_form.html.twig | 0 .../order/item_collection_theme.html.twig | 0 .../order}/preview.html.twig | 4 +- .../order/select_customer.html.twig | 32 ++++------ .../order/select_customer_theme.html.twig | 0 .../order/show}/_item.html.twig | 0 .../order/show}/_summary.html.twig | 0 .../messages.de.yaml | 0 .../messages.en.yaml | 0 .../messages.fr.yaml | 0 .../messages.ru.yaml | 0 .../validators.de.yaml | 0 .../validators.en.yaml | 0 .../validators.fr.yaml | 0 .../validators.ru.yaml | 0 33 files changed, 77 insertions(+), 129 deletions(-) rename src/Resources/config/app/ajax.yml => config/ajax.yaml (87%) rename src/Resources/config/app/config.yml => config/config.yaml (85%) rename src/Resources/config/app/routing.yml => config/routing.yaml (85%) rename {src/Resources/config => config}/services.xml (96%) rename {src/Resources/config => config}/services/reorder_processing.xml (87%) delete mode 100644 docs/legacy_installation.md rename {src/Resources/views => templates/bundles}/SyliusAdminBundle/Order/Show/Summary/_item.html.twig (100%) rename {src/Resources/views => templates/bundles}/SyliusAdminBundle/Order/Show/Summary/_totals.html.twig (100%) rename {src/Resources/views => templates/bundles}/SyliusAdminBundle/Order/Show/_payment.html.twig (100%) rename src/Resources/views/Emails/orderCreated.html.twig => templates/emails/order_created.html.twig (100%) rename {src/Resources/views/Order => templates/order}/create.html.twig (85%) rename {src/Resources/views/Order/Create => templates/order/create}/_breadcrumb.html.twig (100%) rename {src/Resources/views/Order/Create => templates/order/create}/_form.html.twig (100%) rename src/Resources/views/Order/itemCollectionTheme.html.twig => templates/order/item_collection_theme.html.twig (100%) rename {src/Resources/views/Order => templates/order}/preview.html.twig (97%) rename src/Resources/views/Order/selectCustomer.html.twig => templates/order/select_customer.html.twig (76%) rename src/Resources/views/Order/selectCustomerTheme.html.twig => templates/order/select_customer_theme.html.twig (100%) rename {src/Resources/views/Order/Show => templates/order/show}/_item.html.twig (100%) rename {src/Resources/views/Order/Show => templates/order/show}/_summary.html.twig (100%) rename src/Resources/translations/messages.de.yml => translations/messages.de.yaml (100%) rename src/Resources/translations/messages.en.yml => translations/messages.en.yaml (100%) rename src/Resources/translations/messages.fr.yml => translations/messages.fr.yaml (100%) rename src/Resources/translations/messages.ru.yml => translations/messages.ru.yaml (100%) rename src/Resources/translations/validators.de.yml => translations/validators.de.yaml (100%) rename src/Resources/translations/validators.en.yml => translations/validators.en.yaml (100%) rename src/Resources/translations/validators.fr.yml => translations/validators.fr.yaml (100%) rename src/Resources/translations/validators.ru.yml => translations/validators.ru.yaml (100%) diff --git a/README.md b/README.md index f35172096..a1fae6b70 100644 --- a/README.md +++ b/README.md @@ -34,28 +34,44 @@ After creating an Order via Admin panel, this new Order is listed like any other ## Installation -#### Beware! - -> This installation instruction assumes that you're using Symfony Flex. If you don't, take a look at the -[legacy installation instruction](docs/legacy_installation.md). However, we strongly encourage you to use -Symfony Flex, it's much quicker! :) +Requires Sylius `~2.2.0` and PHP `^8.2`. 1. Require plugin with composer: ```bash composer require sylius/admin-order-creation-plugin ``` - + > Remember to allow community recipes with `composer config extra.symfony.allow-contrib true` or during plugin installation process -2. Copy Sylius templates overridden in plugin to your templates directory (e.g `templates/bundles/`): +2. Register the bundle in `config/bundles.php`: + + ```php + Sylius\AdminOrderCreationPlugin\SyliusAdminOrderCreationPlugin::class => ['all' => true], + ``` + +3. Import plugin configuration in `config/packages/sylius_admin_order_creation_plugin.yaml`: + + ```yaml + imports: + - { resource: "@SyliusAdminOrderCreationPlugin/config/config.yaml" } + ``` + +4. Import plugin routes in `config/routes/sylius_admin_order_creation_plugin.yaml`: + + ```yaml + sylius_admin_order_creation_plugin: + resource: "@SyliusAdminOrderCreationPlugin/config/routing.yaml" + ``` + +5. Copy Sylius templates overridden in plugin to your templates directory (e.g `templates/bundles/`): ```bash mkdir -p templates/bundles/SyliusAdminBundle/ - cp -R vendor/sylius/admin-order-creation-plugin/src/Resources/views/SyliusAdminBundle/* templates/bundles/SyliusAdminBundle/ + cp -R vendor/sylius/admin-order-creation-plugin/templates/bundles/SyliusAdminBundle/* templates/bundles/SyliusAdminBundle/ ``` -3. Override repositories +6. Override repositories 1. Create repository classes ```bash @@ -118,7 +134,7 @@ Symfony Flex, it's much quicker! :) ## Extension points Admin Order Creation Plugin makes it possible to add custom discount during order creation - thus some of Order -Show templates need to be replaced with those placed in `Resources/views` package. +Show templates need to be replaced with those placed in the `templates/bundles/SyliusAdminBundle` directory. Payment link generation and sending process is based on logic placed in the PaymentLinkCreationListener class. Thus, it can be easily replaced with suitable implementation. diff --git a/src/Resources/config/app/ajax.yml b/config/ajax.yaml similarity index 87% rename from src/Resources/config/app/ajax.yml rename to config/ajax.yaml index 22c3e21cb..49fd825b5 100644 --- a/src/Resources/config/app/ajax.yml +++ b/config/ajax.yaml @@ -2,7 +2,7 @@ sylius_admin_order_creation_ajax_customer: path: /customer-search methods: [GET] defaults: - _controller: sylius.controller.customer:indexAction + _controller: sylius.controller.customer::indexAction _format: json _sylius: permission: true @@ -14,7 +14,7 @@ sylius_admin_order_creation_ajax_customer_by_email: path: /customer-search-by-email methods: [GET] defaults: - _controller: sylius.controller.customer:indexAction + _controller: sylius.controller.customer::indexAction _format: json _sylius: permission: true @@ -26,7 +26,7 @@ sylius_admin_order_creation_ajax_product_variants_by_phrase_and_channel: path: /product-variant-search/{channelCode} methods: [GET] defaults: - _controller: sylius.controller.product_variant:indexAction + _controller: sylius.controller.product_variant::indexAction _format: json _sylius: permission: true @@ -42,7 +42,7 @@ sylius_admin_order_creation_ajax_product_variant_by_codes: path: /product-variant-search-by-code methods: [GET] defaults: - _controller: sylius.controller.product_variant:indexAction + _controller: sylius.controller.product_variant::indexAction _format: json _sylius: permission: true diff --git a/src/Resources/config/app/config.yml b/config/config.yaml similarity index 85% rename from src/Resources/config/app/config.yml rename to config/config.yaml index 8964c6e19..ccdd0c101 100644 --- a/src/Resources/config/app/config.yml +++ b/config/config.yaml @@ -1,5 +1,5 @@ imports: - - { resource: '@SyliusAdminOrderCreationPlugin/Resources/config/services.xml' } + - { resource: '@SyliusAdminOrderCreationPlugin/config/services.xml' } sylius_grid: grids: @@ -29,4 +29,4 @@ sylius_mailer: emails: order_created_in_admin_panel: subject: 'sylius_admin_order_creation.email.order_created.subject' - template: '@SyliusAdminOrderCreationPlugin/Emails/orderCreated.html.twig' + template: '@SyliusAdminOrderCreationPlugin/emails/order_created.html.twig' diff --git a/src/Resources/config/app/routing.yml b/config/routing.yaml similarity index 85% rename from src/Resources/config/app/routing.yml rename to config/routing.yaml index a235552ba..a5a4a32e3 100644 --- a/src/Resources/config/app/routing.yml +++ b/config/routing.yaml @@ -18,12 +18,12 @@ sylius_admin_order_creation_order_create: options: expose: true defaults: - _controller: sylius.controller.order:createAction + _controller: sylius.controller.order::createAction _sylius: event: admin_create section: admin permission: true - template: '@SyliusAdminOrderCreationPlugin/Order/create.html.twig' + template: '@SyliusAdminOrderCreationPlugin/order/create.html.twig' form: type: Sylius\AdminOrderCreationPlugin\Form\Type\NewOrderType factory: @@ -50,12 +50,12 @@ sylius_admin_order_creation_order_create_from_preview: options: expose: true defaults: - _controller: sylius.controller.order:createAction + _controller: sylius.controller.order::createAction _sylius: event: admin_create section: admin permission: true - template: '@SyliusAdminOrderCreationPlugin/Order/preview.html.twig' + template: '@SyliusAdminOrderCreationPlugin/order/preview.html.twig' form: type: Sylius\AdminOrderCreationPlugin\Form\Type\NewOrderType factory: @@ -78,12 +78,12 @@ sylius_admin_order_creation_reorder: options: expose: true defaults: - _controller: sylius.controller.order:createAction + _controller: sylius.controller.order::createAction _sylius: event: admin_create section: admin permission: true - template: '@SyliusAdminOrderCreationPlugin/Order/create.html.twig' + template: '@SyliusAdminOrderCreationPlugin/order/create.html.twig' form: type: Sylius\AdminOrderCreationPlugin\Form\Type\NewOrderType factory: @@ -92,7 +92,4 @@ sylius_admin_order_creation_reorder: sylius_admin_order_creation_ajax: prefix: admin/ajax - resource: "@SyliusAdminOrderCreationPlugin/Resources/config/app/ajax.yml" - -fos_js_routing: - resource: "@FOSJsRoutingBundle/Resources/config/routing/routing.xml" + resource: "@SyliusAdminOrderCreationPlugin/config/ajax.yaml" diff --git a/src/Resources/config/services.xml b/config/services.xml similarity index 96% rename from src/Resources/config/services.xml rename to config/services.xml index 5e3f1bce4..1387826a7 100644 --- a/src/Resources/config/services.xml +++ b/config/services.xml @@ -32,7 +32,7 @@ - + @@ -89,7 +89,7 @@ - + diff --git a/src/Resources/config/services/reorder_processing.xml b/config/services/reorder_processing.xml similarity index 87% rename from src/Resources/config/services/reorder_processing.xml rename to config/services/reorder_processing.xml index 9eddea77d..29ceadf3e 100644 --- a/src/Resources/config/services/reorder_processing.xml +++ b/config/services/reorder_processing.xml @@ -22,8 +22,8 @@ - - + + diff --git a/docs/legacy_installation.md b/docs/legacy_installation.md deleted file mode 100644 index 2b9443770..000000000 --- a/docs/legacy_installation.md +++ /dev/null @@ -1,61 +0,0 @@ -### Legacy installation (without Symfony Flex) - -1. Require plugin with composer: - - ```bash - composer require sylius/admin-order-creation-plugin - ``` - -2. Import configuration to `app/config/config.yml`: - - ```yaml - imports: - - { resource: "@SyliusAdminOrderCreationPlugin/Resources/config/app/config.yml" } - ``` - -3. Import routing to `app/config/routing.yml`: - - ```yaml - sylius_admin_order_creation: - resource: "@SyliusAdminOrderCreationPlugin/Resources/config/app/routing.yml" - ``` - -4. Add plugin class to your `AppKernel`: - - ```php - $bundles = [ - new \FOS\JsRoutingBundle\FOSJsRoutingBundle(), - new \Sylius\AdminOrderCreationPlugin\SyliusAdminOrderCreationPlugin(), - ]; - ``` - -5. Copy Sylius templates overridden in plugin to your templates directory (e.g `app/Resources/SyliusAdminBundle/views/`): - - ```bash - mkdir -p app/Resources/SyliusAdminBundle/views/ - cp -R vendor/sylius/admin-order-creation-plugin/src/Resources/views/SyliusAdminBundle/* app/Resources/SyliusAdminBundle/views/ - ``` - -6. Override repositories - - As shown [here](tests/Application/Doctrine/ORM) - and [here](tests/Application/config/packages/_sylius.yaml). - -7. Copy plugin migrations to your migrations directory (e.g. `src/Migrations`) and apply them to your database: - - ```bash - cp -R vendor/sylius/admin-order-creation-plugin/migrations/* src/Migrations - bin/console doctrine:migrations:migrate - ``` - -8. Install `FOSJsRoutingBundle` assets: - - ```bash - bin/console assets:install --symlink web - ``` - -8. Clear cache: - - ```bash - bin/console cache:clear - ``` diff --git a/src/Controller/OrderCreateAction.php b/src/Controller/OrderCreateAction.php index bd43332ce..ed72a3a27 100644 --- a/src/Controller/OrderCreateAction.php +++ b/src/Controller/OrderCreateAction.php @@ -25,7 +25,7 @@ final class OrderCreateAction public function __construct( OrderFactoryInterface $orderFactory, FormFactoryInterface $formFactory, - Environment $twig + Environment $twig, ) { $this->orderFactory = $orderFactory; $this->formFactory = $formFactory; @@ -42,7 +42,7 @@ public function __invoke(Request $request): Response $form = $this->formFactory->create(NewOrderType::class, $order); $form->handleRequest($request); - return new Response($this->twig->render('@SyliusAdminOrderCreationPlugin/Order/create.html.twig', [ + return new Response($this->twig->render('@SyliusAdminOrderCreationPlugin/order/create.html.twig', [ 'form' => $form->createView(), ])); } diff --git a/src/Controller/OrderPreviewAction.php b/src/Controller/OrderPreviewAction.php index 5f60575f8..a62c993ee 100644 --- a/src/Controller/OrderPreviewAction.php +++ b/src/Controller/OrderPreviewAction.php @@ -30,7 +30,7 @@ public function __construct( OrderFactoryInterface $orderFactory, FormFactoryInterface $formFactory, OrderProcessorInterface $orderProcessor, - Environment $twig + Environment $twig, ) { $this->orderFactory = $orderFactory; $this->formFactory = $formFactory; @@ -49,7 +49,7 @@ public function __invoke(Request $request): Response $order = $form->handleRequest($request)->getData(); $this->orderProcessor->process($order); - return new Response($this->twig->render('@SyliusAdminOrderCreationPlugin/Order/preview.html.twig', [ + return new Response($this->twig->render('@SyliusAdminOrderCreationPlugin/order/preview.html.twig', [ 'form' => $form->createView(), ])); } diff --git a/src/Controller/SelectNewOrderCustomerAction.php b/src/Controller/SelectNewOrderCustomerAction.php index 188f18bbe..9e6e9c1e0 100644 --- a/src/Controller/SelectNewOrderCustomerAction.php +++ b/src/Controller/SelectNewOrderCustomerAction.php @@ -30,7 +30,7 @@ public function __invoke(Request $request): Response $selectCustomerForm = $this->formFactory->create(NewOrderCustomerSelectType::class); $createCustomerForm = $this->formFactory->create(NewOrderCustomerCreateType::class); - return new Response($this->twig->render('@SyliusAdminOrderCreationPlugin/Order/selectCustomer.html.twig', [ + return new Response($this->twig->render('@SyliusAdminOrderCreationPlugin/order/select_customer.html.twig', [ 'selectCustomerForm' => $selectCustomerForm->createView(), 'createCustomerForm' => $createCustomerForm->createView(), ])); diff --git a/src/DependencyInjection/SyliusAdminOrderCreationExtension.php b/src/DependencyInjection/SyliusAdminOrderCreationExtension.php index 4f77fad5a..c64643d9a 100644 --- a/src/DependencyInjection/SyliusAdminOrderCreationExtension.php +++ b/src/DependencyInjection/SyliusAdminOrderCreationExtension.php @@ -18,7 +18,7 @@ final class SyliusAdminOrderCreationExtension extends Extension implements Prepe public function load(array $config, ContainerBuilder $container): void { $this->processConfiguration($this->getConfiguration([], $container), $config); - $loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config')); + $loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../../config')); } public function prepend(ContainerBuilder $container): void @@ -33,7 +33,7 @@ protected function getMigrationsNamespace(): string protected function getMigrationsDirectory(): string { - return '@SyliusAdminOrderCreationPlugin/Migrations'; + return '@SyliusAdminOrderCreationPlugin/src/Migrations'; } protected function getNamespacesOfMigrationsExecutedBefore(): array diff --git a/src/SyliusAdminOrderCreationPlugin.php b/src/SyliusAdminOrderCreationPlugin.php index 48973d09f..6fb06b2cb 100644 --- a/src/SyliusAdminOrderCreationPlugin.php +++ b/src/SyliusAdminOrderCreationPlugin.php @@ -13,6 +13,11 @@ final class SyliusAdminOrderCreationPlugin extends Bundle { use SyliusPluginTrait; + public function getPath(): string + { + return \dirname(__DIR__); + } + public function build(ContainerBuilder $container): void { $container->addCompilerPass(new RegisterReorderProcessorsPass()); diff --git a/src/Resources/views/SyliusAdminBundle/Order/Show/Summary/_item.html.twig b/templates/bundles/SyliusAdminBundle/Order/Show/Summary/_item.html.twig similarity index 100% rename from src/Resources/views/SyliusAdminBundle/Order/Show/Summary/_item.html.twig rename to templates/bundles/SyliusAdminBundle/Order/Show/Summary/_item.html.twig diff --git a/src/Resources/views/SyliusAdminBundle/Order/Show/Summary/_totals.html.twig b/templates/bundles/SyliusAdminBundle/Order/Show/Summary/_totals.html.twig similarity index 100% rename from src/Resources/views/SyliusAdminBundle/Order/Show/Summary/_totals.html.twig rename to templates/bundles/SyliusAdminBundle/Order/Show/Summary/_totals.html.twig diff --git a/src/Resources/views/SyliusAdminBundle/Order/Show/_payment.html.twig b/templates/bundles/SyliusAdminBundle/Order/Show/_payment.html.twig similarity index 100% rename from src/Resources/views/SyliusAdminBundle/Order/Show/_payment.html.twig rename to templates/bundles/SyliusAdminBundle/Order/Show/_payment.html.twig diff --git a/src/Resources/views/Emails/orderCreated.html.twig b/templates/emails/order_created.html.twig similarity index 100% rename from src/Resources/views/Emails/orderCreated.html.twig rename to templates/emails/order_created.html.twig diff --git a/src/Resources/views/Order/create.html.twig b/templates/order/create.html.twig similarity index 85% rename from src/Resources/views/Order/create.html.twig rename to templates/order/create.html.twig index 02275723c..c26c2782f 100644 --- a/src/Resources/views/Order/create.html.twig +++ b/templates/order/create.html.twig @@ -2,7 +2,7 @@ {% block title %}{{ 'sylius.ui.new_order'|trans }} {{ parent() }}{% endblock %} -{% form_theme form '@SyliusAdminOrderCreationPlugin/Order/itemCollectionTheme.html.twig' %} +{% form_theme form '@SyliusAdminOrderCreationPlugin/order/item_collection_theme.html.twig' %} {% if order is defined %} {% set customer_id = order.customer.id %} @@ -19,18 +19,19 @@
{{ 'sylius.ui.new_order'|trans }}
- {% include '@SyliusAdminOrderCreationPlugin/Order/Create/_breadcrumb.html.twig' %} + {% include '@SyliusAdminOrderCreationPlugin/order/create/_breadcrumb.html.twig' %} - {% include '@SyliusAdminOrderCreationPlugin/Order/Create/_form.html.twig' with { + {% include '@SyliusAdminOrderCreationPlugin/order/create/_form.html.twig' with { 'action': path('sylius_admin_order_creation_order_preview', {'customerId': customer_id, 'channelCode': channel_code}) } %} {% endblock %} {% block javascripts %} {{ parent() }} - - + - +