Skip to content

Commit

Permalink
Merge pull request #342 from GSadee/directory-structure
Browse files Browse the repository at this point in the history
Reorganize directory structure
  • Loading branch information
Rafikooo authored Nov 20, 2024
2 parents dc2ec13 + 213e98c commit 2fde725
Show file tree
Hide file tree
Showing 55 changed files with 50 additions and 14 deletions.
31 changes: 31 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,37 @@
1. Support for Sylius 1.12 has been dropped, upgrade your application to [Sylius 1.13](https://github.com/Sylius/Sylius/blob/1.13/UPGRADE-1.13.md).
or [Sylius 1.14](https://github.com/Sylius/Sylius/blob/1.14/UPGRADE-1.14.md).

1. The directories structure has been updated to the current Symfony recommendations:
- `@SyliusInvoicingPlugin/Resources/assets` -> `@SyliusInvoicingPlugin/assets`
- `@SyliusInvoicingPlugin/Resources/config` -> `@SyliusInvoicingPlugin/config`
- `@SyliusInvoicingPlugin/Resources/translations` -> `@SyliusInvoicingPlugin/translations`
- `@SyliusInvoicingPlugin/Resources/views` -> `@SyliusInvoicingPlugin/templates`

You need to adjust the import of configuration file in your end application:
```diff
imports:
- - { resource: "@SyliusInvoicingPlugin/Resources/config/config.yml" }
+ - { resource: '@SyliusInvoicingPlugin/config/config.yaml' }
```

And the routes configuration paths:
```diff
sylius_invoicing_plugin_admin:
- resource: "@SyliusInvoicingPlugin/Resources/config/app/routing/admin_invoicing.yml"
- prefix: /admin
+ resource: '@SyliusInvoicingPlugin/config/admin_routes.yaml'
+ prefix: '/%sylius_admin.path_name%'

sylius_invoicing_plugin_shop:
- resource: "@SyliusInvoicingPlugin/Resources/config/app/routing/shop_invoicing.yml"
+ resource: '@SyliusInvoicingPlugin/config/shop_routes.yaml'
prefix: /{_locale}
requirements:
_locale: ^[a-z]{2}(?:_[A-Z]{2})?$
```

And the paths to assets and templates if you are using them.

1. The deprecated method `Sylius\InvoicingPlugin\Entity\InvoiceInterface::orderNumber()` has been removed,
use `Sylius\InvoicingPlugin\Entity\InvoiceInterface::order()` instead.

Expand Down
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/Resources/config/services.xml → config/services.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</imports>

<parameters>
<parameter key="default_logo_file">@SyliusInvoicingPlugin/Resources/assets/sylius-logo.png</parameter>
<parameter key="default_logo_file">@SyliusInvoicingPlugin/assets/sylius-logo.png</parameter>
<parameter key="sylius.invoicing.template.logo_file">%env(default:default_logo_file:resolve:SYLIUS_INVOICING_LOGO_FILE)%</parameter>
</parameters>

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
8 changes: 4 additions & 4 deletions docs/legacy_installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,18 @@

```yaml
imports:
- { resource: "@SyliusInvoicingPlugin/Resources/config/config.yml" }
- { resource: '@SyliusInvoicingPlugin/config/config.yaml' }
```
1. Import routing:
```yaml
sylius_invoicing_plugin_admin:
resource: "@SyliusInvoicingPlugin/Resources/config/app/routing/admin_invoicing.yml"
prefix: /admin
resource: '@SyliusInvoicingPlugin/config/admin_routes.yaml'
prefix: '/%sylius_admin.path_name%'
sylius_invoicing_plugin_shop:
resource: "@SyliusInvoicingPlugin/Resources/config/app/routing/shop_invoicing.yml"
resource: '@SyliusInvoicingPlugin/config/shop_routes.yaml'
prefix: /{_locale}
requirements:
_locale: ^[a-z]{2}(?:_[A-Z]{2})?$
Expand Down
4 changes: 2 additions & 2 deletions spec/Generator/InvoicePdfFileGeneratorSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ function let(
$fileLocator,
$invoiceFileNameGenerator,
'invoiceTemplate.html.twig',
'@SyliusInvoicingPlugin/Resources/assets/sylius-logo.png',
'@SyliusInvoicingPlugin/assets/sylius-logo.png',
);
}

Expand All @@ -53,7 +53,7 @@ function it_creates_invoice_pdf_with_generated_content_and_filename_basing_on_in
$invoiceFileNameGenerator->generateForPdf($invoice)->willReturn('2015_05_00004444.pdf');
$invoice->channel()->willReturn($channel);

$fileLocator->locate('@SyliusInvoicingPlugin/Resources/assets/sylius-logo.png')->willReturn('located-path/sylius-logo.png');
$fileLocator->locate('@SyliusInvoicingPlugin/assets/sylius-logo.png')->willReturn('located-path/sylius-logo.png');

$twigToPdfGenerator
->generate('invoiceTemplate.html.twig', ['invoice' => $invoice, 'channel' => $channel, 'invoiceLogoPath' => 'located-path/sylius-logo.png'])
Expand Down
4 changes: 2 additions & 2 deletions src/DependencyInjection/SyliusInvoicingExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ final class SyliusInvoicingExtension extends AbstractResourceExtension implement

public function load(array $configs, ContainerBuilder $container): void
{
$loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
$loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../../config'));
$loader->load('services.xml');

/** @var ConfigurationInterface $configuration */
Expand Down Expand Up @@ -55,7 +55,7 @@ protected function getMigrationsNamespace(): string

protected function getMigrationsDirectory(): string
{
return '@SyliusInvoicingPlugin/Migrations';
return '@SyliusInvoicingPlugin/src/Migrations';
}

protected function getNamespacesOfMigrationsExecutedBefore(): array
Expand Down
5 changes: 5 additions & 0 deletions src/SyliusInvoicingPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,9 @@ public function build(ContainerBuilder $container): void

$container->addCompilerPass(new SymfonyClockCompilerPass());
}

public function getPath(): string
{
return \dirname(__DIR__);
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion tests/Application/config/packages/_sylius.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ imports:

- { resource: "@SyliusShopBundle/Resources/config/app/config.yml" }

- { resource: "@SyliusInvoicingPlugin/Resources/config/config.yml" }
- { resource: "@SyliusInvoicingPlugin/config/config.yaml" }

- { resource: "@SyliusApiBundle/Resources/config/app/config.yaml" }
parameters:
Expand Down
2 changes: 1 addition & 1 deletion tests/Application/config/packages/sylius_invoicing.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
imports:
- { resource: "@SyliusInvoicingPlugin/Resources/config/config.yml" }
- { resource: "@SyliusInvoicingPlugin/config/config.yaml" }
4 changes: 2 additions & 2 deletions tests/Application/config/routes/sylius_invoicing_plugin.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
sylius_invoicing_plugin_admin:
resource: "@SyliusInvoicingPlugin/Resources/config/app/routing/admin_invoicing.yml"
resource: "@SyliusInvoicingPlugin/config/admin_routes.yaml"
prefix: /admin

sylius_invoicing_plugin_shop:
resource: "@SyliusInvoicingPlugin/Resources/config/app/routing/shop_invoicing.yml"
resource: "@SyliusInvoicingPlugin/config/shop_routes.yaml"
prefix: /{_locale}
requirements:
_locale: ^[a-z]{2}(?:_[A-Z]{2})?$
2 changes: 1 addition & 1 deletion tests/DependencyInjection/SyliusInvoicingExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function it_autoconfigures_prepending_doctrine_migration_with_proper_migr
$doctrineMigrationsExtensionConfig[0]['migrations_paths']['Sylius\InvoicingPlugin\Migrations']
));
self::assertSame(
'@SyliusInvoicingPlugin/Migrations',
'@SyliusInvoicingPlugin/src/Migrations',
$doctrineMigrationsExtensionConfig[0]['migrations_paths']['Sylius\InvoicingPlugin\Migrations']
);

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 2fde725

Please sign in to comment.