From 6d864948d82b0119d566fbc558b435ed1a0ceb0e Mon Sep 17 00:00:00 2001 From: Rafikooo Date: Mon, 9 Dec 2024 03:35:38 +0100 Subject: [PATCH] [Maintenance] Reorganize config files and update their extensions --- UPGRADE-2.0.md | 18 ++++++++++++++---- .../{admin_routing.yml => admin_routes.yaml} | 0 config/{app/config.yml => config.yaml} | 4 ++-- config/{app => }/integrations.php | 0 config/{shop_routing.yml => shop_routes.yaml} | 0 .../twig_hooks/admin/credit_memo/show.yaml | 0 .../twig_hooks/admin/order/refund/show.yaml | 0 .../{app => }/twig_hooks/admin/order/show.yaml | 0 .../twig_hooks/shop/account/order/show.yaml | 0 docs/legacy_installation.md | 16 ++++++++++++---- ecs.php | 1 - phpstan.neon | 1 - .../config/packages/sylius_refund.yaml | 2 +- tests/Application/config/routes.yaml | 2 -- .../config/routes/sylius_refund.yaml | 4 ++-- 15 files changed, 31 insertions(+), 17 deletions(-) rename config/{admin_routing.yml => admin_routes.yaml} (100%) rename config/{app/config.yml => config.yaml} (97%) rename config/{app => }/integrations.php (100%) rename config/{shop_routing.yml => shop_routes.yaml} (100%) rename config/{app => }/twig_hooks/admin/credit_memo/show.yaml (100%) rename config/{app => }/twig_hooks/admin/order/refund/show.yaml (100%) rename config/{app => }/twig_hooks/admin/order/show.yaml (100%) rename config/{app => }/twig_hooks/shop/account/order/show.yaml (100%) delete mode 100644 tests/Application/config/routes.yaml rename config/routing.yml => tests/Application/config/routes/sylius_refund.yaml (57%) diff --git a/UPGRADE-2.0.md b/UPGRADE-2.0.md index a484046bc..ebb66fce3 100644 --- a/UPGRADE-2.0.md +++ b/UPGRADE-2.0.md @@ -24,7 +24,8 @@ bin/console doctrine:migrations:migrate --no-interaction ``` -1. The directories structure has been updated to the current Symfony recommendations: +1. The structures of the directories have been updated to follow the current Symfony recommendations: + - `@SyliusRefundPlugin/Resources/assets` -> `@SyliusRefundPlugin/assets` - `@SyliusRefundPlugin/Resources/config` -> `@SyliusRefundPlugin/config` - `@SyliusRefundPlugin/Resources/translations` -> `@SyliusRefundPlugin/translations` - `@SyliusRefundPlugin/Resources/views` -> `@SyliusRefundPlugin/templates` @@ -38,9 +39,18 @@ And the routes configuration paths: ```diff - sylius_refund: - - resource: "@SyliusRefundPlugin/Resources/config/routing.yml" - + resource: "@SyliusRefundPlugin/config/routing.yml" + - sylius_refund: + - resource: "@SyliusRefundPlugin/Resources/config/routing.yml" + + sylius_refund_admin: + + resource: "@SyliusRefundPlugin/config/admin_routes.yaml" + + prefix: '/%sylius_admin.path_name%' + + + + sylius_refund_shop: + + resource: "@SyliusRefundPlugin/config/shop_routes.yaml" + + prefix: /{_locale} + + requirements: + + _locale: ^[a-z]{2}(?:_[A-Z]{2})?$ + ``` Adjust the paths to assets and templates if you are using them. diff --git a/config/admin_routing.yml b/config/admin_routes.yaml similarity index 100% rename from config/admin_routing.yml rename to config/admin_routes.yaml diff --git a/config/app/config.yml b/config/config.yaml similarity index 97% rename from config/app/config.yml rename to config/config.yaml index f1f51b189..49ebccc3f 100644 --- a/config/app/config.yml +++ b/config/config.yaml @@ -1,6 +1,6 @@ imports: - - { resource: "@SyliusRefundPlugin/config/app/twig_hooks/**/*.yaml" } - - { resource: "@SyliusRefundPlugin/config/app/integrations.php" } + - { resource: "@SyliusRefundPlugin/config/twig_hooks/**/*.yaml" } + - { resource: "@SyliusRefundPlugin/config/integrations.php" } parameters: sylius_refund.credit_memo_save_path: "%kernel.project_dir%/private/credit_memos/" diff --git a/config/app/integrations.php b/config/integrations.php similarity index 100% rename from config/app/integrations.php rename to config/integrations.php diff --git a/config/shop_routing.yml b/config/shop_routes.yaml similarity index 100% rename from config/shop_routing.yml rename to config/shop_routes.yaml diff --git a/config/app/twig_hooks/admin/credit_memo/show.yaml b/config/twig_hooks/admin/credit_memo/show.yaml similarity index 100% rename from config/app/twig_hooks/admin/credit_memo/show.yaml rename to config/twig_hooks/admin/credit_memo/show.yaml diff --git a/config/app/twig_hooks/admin/order/refund/show.yaml b/config/twig_hooks/admin/order/refund/show.yaml similarity index 100% rename from config/app/twig_hooks/admin/order/refund/show.yaml rename to config/twig_hooks/admin/order/refund/show.yaml diff --git a/config/app/twig_hooks/admin/order/show.yaml b/config/twig_hooks/admin/order/show.yaml similarity index 100% rename from config/app/twig_hooks/admin/order/show.yaml rename to config/twig_hooks/admin/order/show.yaml diff --git a/config/app/twig_hooks/shop/account/order/show.yaml b/config/twig_hooks/shop/account/order/show.yaml similarity index 100% rename from config/app/twig_hooks/shop/account/order/show.yaml rename to config/twig_hooks/shop/account/order/show.yaml diff --git a/docs/legacy_installation.md b/docs/legacy_installation.md index 2a714625e..21d810f10 100644 --- a/docs/legacy_installation.md +++ b/docs/legacy_installation.md @@ -19,15 +19,23 @@ ```yaml imports: - - { resource: "@SyliusRefundPlugin/config/app/config.yml" } + - { resource: "@SyliusRefundPlugin/config/config.yaml" } ``` 1. Import routing: ````yaml - sylius_refund: - resource: "@SyliusRefundPlugin/config/routing.yml" + sylius_refund_admin: + resource: "@SyliusRefundPlugin/config/admin_routes.yaml" + prefix: '/%sylius_admin.path_name%' + + sylius_refund_shop: + resource: "@SyliusRefundPlugin/config/shop_routes.yaml" + prefix: /{_locale} + requirements: + _locale: ^[a-z]{2}(?:_[A-Z]{2})?$ + ```` - + 1. Apply migrations to your database: ```bash diff --git a/ecs.php b/ecs.php index 4d179d7a7..3fc32f750 100644 --- a/ecs.php +++ b/ecs.php @@ -18,7 +18,6 @@ $containerConfigurator->skip([ VisibilityRequiredFixer::class => ['*Spec.php'], InlineDocCommentDeclarationSniff::class . '.MissingVariable', - 'src/Resources/config/**', '**/var/*', ]); diff --git a/phpstan.neon b/phpstan.neon index cefe88bbb..dd1b4c50e 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -12,7 +12,6 @@ parameters: - 'src/DependencyInjection/Configuration.php' # Test dependencies - - 'tests/Application/app/**.php' - 'tests/Application/src/**.php' ignoreErrors: diff --git a/tests/Application/config/packages/sylius_refund.yaml b/tests/Application/config/packages/sylius_refund.yaml index ee42ca1f0..5107d4fb1 100644 --- a/tests/Application/config/packages/sylius_refund.yaml +++ b/tests/Application/config/packages/sylius_refund.yaml @@ -1,2 +1,2 @@ imports: - - { resource: "@SyliusRefundPlugin/config/app/config.yml" } + - { resource: "@SyliusRefundPlugin/config/config.yaml" } diff --git a/tests/Application/config/routes.yaml b/tests/Application/config/routes.yaml deleted file mode 100644 index 5a8d73d32..000000000 --- a/tests/Application/config/routes.yaml +++ /dev/null @@ -1,2 +0,0 @@ -sylius_refund: - resource: "@SyliusRefundPlugin/config/routing.yml" diff --git a/config/routing.yml b/tests/Application/config/routes/sylius_refund.yaml similarity index 57% rename from config/routing.yml rename to tests/Application/config/routes/sylius_refund.yaml index 3bb7c2fa6..fc790e935 100644 --- a/config/routing.yml +++ b/tests/Application/config/routes/sylius_refund.yaml @@ -1,9 +1,9 @@ sylius_refund_admin: - resource: "@SyliusRefundPlugin/config/admin_routing.yml" + resource: "@SyliusRefundPlugin/config/admin_routes.yaml" prefix: '/%sylius_admin.path_name%' sylius_refund_shop: - resource: "@SyliusRefundPlugin/config/shop_routing.yml" + resource: "@SyliusRefundPlugin/config/shop_routes.yaml" prefix: /{_locale} requirements: _locale: ^[a-z]{2}(?:_[A-Z]{2})?$