Skip to content
Merged
9 changes: 4 additions & 5 deletions concepts/framework/data-abstraction-layer.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,10 @@ If you are using [Service autowiring](https://symfony.com/doc/current/service_co

Alternatively, configure the `product.repository` service to be injected explicitly:

```html
// <plugin root>src/Resources/config/service.xml
<service id="Swag\ExamplePlugin\Service\DalExampleService">
<argument type="service" id="product.repository"/>
</service>
```php
// <plugin root>src/Resources/config/services.php
$services->set(Swag\ExamplePlugin\Service\DalExampleService::class)
->args([service('product.repository')]);
```

You can read more about dependency injection and service registration in Shopware in the services guides:
Expand Down
7 changes: 3 additions & 4 deletions guides/hosting/configurations/observability/profiling.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,9 @@
}
```

```XML
<service id="App\Profiler">
<tag name="shopware.profiler" integration="Console"/>
</service>
```php

Check warning on line 73 in guides/hosting/configurations/observability/profiling.md

View workflow job for this annotation

GitHub Actions / LanguageTool

[LanguageTool] guides/hosting/configurations/observability/profiling.md#L73

File types are normally capitalized. (FILE_EXTENSIONS_CASE[1]) Suggestions: `PHP` URL: https://languagetool.org/insights/post/spelling-capital-letters/ Rule: https://community.languagetool.org/rule/show/FILE_EXTENSIONS_CASE?lang=en-US&subId=1 Category: CASING
Raw output
guides/hosting/configurations/observability/profiling.md:73:3: File types are normally capitalized. (FILE_EXTENSIONS_CASE[1])
 Suggestions: `PHP`
 URL: https://languagetool.org/insights/post/spelling-capital-letters/ 
 Rule: https://community.languagetool.org/rule/show/FILE_EXTENSIONS_CASE?lang=en-US&subId=1
 Category: CASING
$services->set(App\Profiler::class)
->tag('shopware.profiler', ['integration' => 'Console']);
```

The attribute `integration` is used to identify the profiler backend in the configuration.
7 changes: 3 additions & 4 deletions guides/hosting/performance/session.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,9 @@

Example service definition:

```xml
<service id="session.db" class="Symfony\Component\HttpFoundation\Session\Storage\Handler\PdoSessionHandler">
<argument ....></argument>
</service>
```php

Check warning on line 54 in guides/hosting/performance/session.md

View workflow job for this annotation

GitHub Actions / LanguageTool

[LanguageTool] guides/hosting/performance/session.md#L54

File types are normally capitalized. (FILE_EXTENSIONS_CASE[1]) Suggestions: `PHP` URL: https://languagetool.org/insights/post/spelling-capital-letters/ Rule: https://community.languagetool.org/rule/show/FILE_EXTENSIONS_CASE?lang=en-US&subId=1 Category: CASING
Raw output
guides/hosting/performance/session.md:54:3: File types are normally capitalized. (FILE_EXTENSIONS_CASE[1])
 Suggestions: `PHP`
 URL: https://languagetool.org/insights/post/spelling-capital-letters/ 
 Rule: https://community.languagetool.org/rule/show/FILE_EXTENSIONS_CASE?lang=en-US&subId=1
 Category: CASING
$services->set('session.db', Symfony\Component\HttpFoundation\Session\Storage\Handler\PdoSessionHandler::class)
->args([/* ... */]);
```

Example session configuration:
Expand Down
6 changes: 3 additions & 3 deletions guides/plugins/plugins/bundle.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ project-root/
│ │ └── Migration1234567890YourMigration.php
│ └── Resources/
│ ├── config/
│ │ ├── services.xml
│ │ └── routes.xml
│ │ ├── services.php
│ │ └── routes.php
│ ├── views/
│ │ └── storefront/
│ │ └── page/
Expand Down Expand Up @@ -92,7 +92,7 @@ App\YourBundleName\YourBundleName::class => ['all' => true],
## Adding services, twig templates, routes, theme, etc

You can add services, twig templates, routes, etc. to your bundle like you would do in a plugin.
Just create `Resources/config/services.xml` and `Resources/config/routes.xml` files or `Resources/views` for twig templates.
Just create `Resources/config/services.php` and `Resources/config/routes.php` files or `Resources/views` for twig templates.
The bundle will be automatically detected and the files will be loaded.

To mark your bundle as a theme, it's enough to implement the `Shopware\Core\Framework\ThemeInterface` interface in your bundle class.
Expand Down
2 changes: 1 addition & 1 deletion guides/plugins/plugins/checkout/cart/add-cart-discounts.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,4 +120,4 @@ Shopware comes with a called `LineItemRule`, which requires two parameters:

After adding the definition to the line item, we have to calculate the current price of the discount. Therefore we can use the `PercentagePriceCalculator` of the core. The last step is to add the discount to the new cart which is provided as `Cart $toCalculate`.

That's it for the main code of our custom `CartProcessor`. Now we only have to register it in our `services.xml` using the tag `shopware.cart.processor` and priority `4500`, which is used to get access to the calculation after the [product processor](https://github.com/shopware/shopware/blob/v6.3.4.1/src/Core/Checkout/DependencyInjection/cart.xml#L223-L231) handled the products.
That's it for the main code of our custom `CartProcessor`. Now we only have to register it in our `services.php` using the tag `shopware.cart.processor` and priority `4500`, which is used to get access to the calculation after the [product processor](https://github.com/shopware/shopware/blob/v6.3.4.1/src/Core/Checkout/DependencyInjection/cart.xml#L223-L231) handled the products.
52 changes: 28 additions & 24 deletions guides/plugins/plugins/checkout/cart/add-cart-items.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,19 +100,19 @@

You need to create a new class which implements the interface `\Shopware\Core\Checkout\Cart\LineItemFactoryHandler\LineItemFactoryInterface` and it needs to be registered in the DI container with the tag `shopware.cart.line_item.factory`.

```xml
// <plugin root>/src/Resources/config/services.xml
<?xml version="1.0" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">

<services>
<service id="Swag\BasicExample\Service\ExampleHandler">
<tag name="shopware.cart.line_item.factory" />
</service>
</services>
</container>
```php

Check warning on line 103 in guides/plugins/plugins/checkout/cart/add-cart-items.md

View workflow job for this annotation

GitHub Actions / LanguageTool

[LanguageTool] guides/plugins/plugins/checkout/cart/add-cart-items.md#L103

File types are normally capitalized. (FILE_EXTENSIONS_CASE[1]) Suggestions: `PHP` URL: https://languagetool.org/insights/post/spelling-capital-letters/ Rule: https://community.languagetool.org/rule/show/FILE_EXTENSIONS_CASE?lang=en-US&subId=1 Category: CASING
Raw output
guides/plugins/plugins/checkout/cart/add-cart-items.md:103:3: File types are normally capitalized. (FILE_EXTENSIONS_CASE[1])
 Suggestions: `PHP`
 URL: https://languagetool.org/insights/post/spelling-capital-letters/ 
 Rule: https://community.languagetool.org/rule/show/FILE_EXTENSIONS_CASE?lang=en-US&subId=1
 Category: CASING
// <plugin root>/src/Resources/config/services.php
<?php declare(strict_types=1);

use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Swag\BasicExample\Service\ExampleHandler;

return static function (ContainerConfigurator $configurator): void {
$services = $configurator->services();

$services->set(ExampleHandler::class)
->tag('shopware.cart.line_item.factory');
};
```

Let's first have a look at an example handler:
Expand Down Expand Up @@ -199,17 +199,21 @@

Of course you can use processors to do much more than this. Have a look at [adding cart processors and collectors](./add-cart-processor-collector).

Now register this processor in your `services.xml` like this:

```html
// <plugin root>/Resources/config/services.xml
...
<services>
...
<service id="Swag\BasicExample\Core\Checkout\Cart\ExampleProcessor">
<tag name="shopware.cart.processor" priority="4800"/>
</service>
</services>
Now register this processor in your `services.php` like this:

```php

Check warning on line 204 in guides/plugins/plugins/checkout/cart/add-cart-items.md

View workflow job for this annotation

GitHub Actions / LanguageTool

[LanguageTool] guides/plugins/plugins/checkout/cart/add-cart-items.md#L204

File types are normally capitalized. (FILE_EXTENSIONS_CASE[1]) Suggestions: `PHP` URL: https://languagetool.org/insights/post/spelling-capital-letters/ Rule: https://community.languagetool.org/rule/show/FILE_EXTENSIONS_CASE?lang=en-US&subId=1 Category: CASING
Raw output
guides/plugins/plugins/checkout/cart/add-cart-items.md:204:3: File types are normally capitalized. (FILE_EXTENSIONS_CASE[1])
 Suggestions: `PHP`
 URL: https://languagetool.org/insights/post/spelling-capital-letters/ 
 Rule: https://community.languagetool.org/rule/show/FILE_EXTENSIONS_CASE?lang=en-US&subId=1
 Category: CASING
// <plugin root>/src/Resources/config/services.php
<?php declare(strict_types=1);

use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Swag\BasicExample\Core\Checkout\Cart\ExampleProcessor;

return static function (ContainerConfigurator $configurator): void {
$services = $configurator->services();

$services->set(ExampleProcessor::class)
->tag('shopware.cart.processor', ['priority' => 4800]);
};
```

And that's it. You should now be able to create line items of type `example`.
Expand Down
26 changes: 13 additions & 13 deletions guides/plugins/plugins/checkout/cart/add-cart-validator.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,19 +76,19 @@

Your validator has to be registered using the tag `shopware.cart.validator`:

```xml
// <plugin root>/src/Resources/config/services.xml
<?xml version="1.0" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">

<services>
<service id="Swag\BasicExample\Core\Checkout\Cart\Custom\CustomCartValidator">
<tag name="shopware.cart.validator"/>
</service>
</services>
</container>
```php

Check warning on line 79 in guides/plugins/plugins/checkout/cart/add-cart-validator.md

View workflow job for this annotation

GitHub Actions / LanguageTool

[LanguageTool] guides/plugins/plugins/checkout/cart/add-cart-validator.md#L79

File types are normally capitalized. (FILE_EXTENSIONS_CASE[1]) Suggestions: `PHP` URL: https://languagetool.org/insights/post/spelling-capital-letters/ Rule: https://community.languagetool.org/rule/show/FILE_EXTENSIONS_CASE?lang=en-US&subId=1 Category: CASING
Raw output
guides/plugins/plugins/checkout/cart/add-cart-validator.md:79:3: File types are normally capitalized. (FILE_EXTENSIONS_CASE[1])
 Suggestions: `PHP`
 URL: https://languagetool.org/insights/post/spelling-capital-letters/ 
 Rule: https://community.languagetool.org/rule/show/FILE_EXTENSIONS_CASE?lang=en-US&subId=1
 Category: CASING
// <plugin root>/src/Resources/config/services.php
<?php declare(strict_types=1);

use Swag\BasicExample\Core\Checkout\Cart\Custom\CustomCartValidator;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;

return static function (ContainerConfigurator $configurator): void {
$services = $configurator->services();

$services->set(CustomCartValidator::class)
->tag('shopware.cart.validator');
};
```

### Adding the custom cart error
Expand Down
38 changes: 21 additions & 17 deletions guides/plugins/plugins/checkout/cart/change-price-of-item.md
Original file line number Diff line number Diff line change
Expand Up @@ -263,23 +263,27 @@

Let's have a look at it:

```xml
// <plugin root>/src/Resources/config/services.xml
<?xml version="1.0" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">

<services>
<service id="Swag\BasicExample\Core\Checkout\Cart\OverwritePriceCollector">
<argument type="service" id="Shopware\Core\Checkout\Cart\Price\QuantityPriceCalculator"/>

<!-- after product collector/processor -->
<tag name="shopware.cart.processor" priority="4500" />
<tag name="shopware.cart.collector" priority="4500" />
</service>
</services>
</container>
```php

Check warning on line 266 in guides/plugins/plugins/checkout/cart/change-price-of-item.md

View workflow job for this annotation

GitHub Actions / LanguageTool

[LanguageTool] guides/plugins/plugins/checkout/cart/change-price-of-item.md#L266

File types are normally capitalized. (FILE_EXTENSIONS_CASE[1]) Suggestions: `PHP` URL: https://languagetool.org/insights/post/spelling-capital-letters/ Rule: https://community.languagetool.org/rule/show/FILE_EXTENSIONS_CASE?lang=en-US&subId=1 Category: CASING
Raw output
guides/plugins/plugins/checkout/cart/change-price-of-item.md:266:3: File types are normally capitalized. (FILE_EXTENSIONS_CASE[1])
 Suggestions: `PHP`
 URL: https://languagetool.org/insights/post/spelling-capital-letters/ 
 Rule: https://community.languagetool.org/rule/show/FILE_EXTENSIONS_CASE?lang=en-US&subId=1
 Category: CASING
// <plugin root>/src/Resources/config/services.php
<?php declare(strict_types=1);

use Shopware\Core\Checkout\Cart\Price\QuantityPriceCalculator;
use Swag\BasicExample\Core\Checkout\Cart\OverwritePriceCollector;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;

use function Symfony\Component\DependencyInjection\Loader\Configurator\service;

return static function (ContainerConfigurator $configurator): void {
$services = $configurator->services();

$services->set(OverwritePriceCollector::class)
->args([
service(QuantityPriceCalculator::class),
])
// after product collector/processor
->tag('shopware.cart.processor', ['priority' => 4500])
->tag('shopware.cart.collector', ['priority' => 4500]);
};
```

And that's it. Your processor / collector should now be working.
32 changes: 19 additions & 13 deletions guides/plugins/plugins/checkout/cart/customize-price-calculation.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,19 +81,25 @@

Do not forget to actually register your decoration to the service container, otherwise it will not have any effect.

```xml
// <plugin root>/src/Resources/config/services.xml
<?xml version="1.0" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">

<services>
<service id="Swag\BasicExample\Service\CustomProductPriceCalculator" decorates="Shopware\Core\Content\Product\SalesChannel\Price\ProductPriceCalculator">
<argument type="service" id="Swag\BasicExample\Service\CustomProductPriceCalculator.inner" />
</service>
</services>
</container>
```php

Check warning on line 84 in guides/plugins/plugins/checkout/cart/customize-price-calculation.md

View workflow job for this annotation

GitHub Actions / LanguageTool

[LanguageTool] guides/plugins/plugins/checkout/cart/customize-price-calculation.md#L84

File types are normally capitalized. (FILE_EXTENSIONS_CASE[1]) Suggestions: `PHP` URL: https://languagetool.org/insights/post/spelling-capital-letters/ Rule: https://community.languagetool.org/rule/show/FILE_EXTENSIONS_CASE?lang=en-US&subId=1 Category: CASING
Raw output
guides/plugins/plugins/checkout/cart/customize-price-calculation.md:84:3: File types are normally capitalized. (FILE_EXTENSIONS_CASE[1])
 Suggestions: `PHP`
 URL: https://languagetool.org/insights/post/spelling-capital-letters/ 
 Rule: https://community.languagetool.org/rule/show/FILE_EXTENSIONS_CASE?lang=en-US&subId=1
 Category: CASING
// <plugin root>/src/Resources/config/services.php
<?php declare(strict_types=1);

use Shopware\Core\Content\Product\SalesChannel\Price\ProductPriceCalculator;
use Swag\BasicExample\Service\CustomProductPriceCalculator;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;

use function Symfony\Component\DependencyInjection\Loader\Configurator\service;

return static function (ContainerConfigurator $configurator): void {
$services = $configurator->services();

$services->set(CustomProductPriceCalculator::class)
->decorate(ProductPriceCalculator::class)
->args([
service('.inner'),

Check warning on line 100 in guides/plugins/plugins/checkout/cart/customize-price-calculation.md

View workflow job for this annotation

GitHub Actions / LanguageTool

[LanguageTool] guides/plugins/plugins/checkout/cart/customize-price-calculation.md#L100

Unpaired symbol: ‘'’ seems to be missing (EN_UNPAIRED_QUOTES) URL: https://languagetool.org/insights/post/punctuation-guide/#what-are-parentheses Rule: https://community.languagetool.org/rule/show/EN_UNPAIRED_QUOTES?lang=en-US Category: PUNCTUATION
Raw output
guides/plugins/plugins/checkout/cart/customize-price-calculation.md:100:20: Unpaired symbol: ‘'’ seems to be missing (EN_UNPAIRED_QUOTES)
 URL: https://languagetool.org/insights/post/punctuation-guide/#what-are-parentheses 
 Rule: https://community.languagetool.org/rule/show/EN_UNPAIRED_QUOTES?lang=en-US
 Category: PUNCTUATION

Check warning on line 100 in guides/plugins/plugins/checkout/cart/customize-price-calculation.md

View workflow job for this annotation

GitHub Actions / LanguageTool

[LanguageTool] guides/plugins/plugins/checkout/cart/customize-price-calculation.md#L100

Unpaired symbol: ‘'’ seems to be missing (EN_UNPAIRED_QUOTES) URL: https://languagetool.org/insights/post/punctuation-guide/#what-are-parentheses Rule: https://community.languagetool.org/rule/show/EN_UNPAIRED_QUOTES?lang=en-US Category: PUNCTUATION
Raw output
guides/plugins/plugins/checkout/cart/customize-price-calculation.md:100:27: Unpaired symbol: ‘'’ seems to be missing (EN_UNPAIRED_QUOTES)
 URL: https://languagetool.org/insights/post/punctuation-guide/#what-are-parentheses 
 Rule: https://community.languagetool.org/rule/show/EN_UNPAIRED_QUOTES?lang=en-US
 Category: PUNCTUATION
]);
};
```

## Next steps
Expand Down
24 changes: 12 additions & 12 deletions guides/plugins/plugins/checkout/cart/tax-provider.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,21 +83,21 @@

## Registering the tax provider in the DI container

After you have created your tax provider, you need to register it in the DI container. To do so, you need to create a new service in the `services.xml` file and tag the service as `shopware.tax.provider`.
After you have created your tax provider, you need to register it in the DI container. To do so, you need to create a new service in the `services.php` file and tag the service as `shopware.tax.provider`.

```xml
// <plugin root>/src/Resources/config/services.xml
<?xml version="1.0" ?>
```php

Check warning on line 88 in guides/plugins/plugins/checkout/cart/tax-provider.md

View workflow job for this annotation

GitHub Actions / LanguageTool

[LanguageTool] guides/plugins/plugins/checkout/cart/tax-provider.md#L88

File types are normally capitalized. (FILE_EXTENSIONS_CASE[1]) Suggestions: `PHP` URL: https://languagetool.org/insights/post/spelling-capital-letters/ Rule: https://community.languagetool.org/rule/show/FILE_EXTENSIONS_CASE?lang=en-US&subId=1 Category: CASING
Raw output
guides/plugins/plugins/checkout/cart/tax-provider.md:88:3: File types are normally capitalized. (FILE_EXTENSIONS_CASE[1])
 Suggestions: `PHP`
 URL: https://languagetool.org/insights/post/spelling-capital-letters/ 
 Rule: https://community.languagetool.org/rule/show/FILE_EXTENSIONS_CASE?lang=en-US&subId=1
 Category: CASING
// <plugin root>/src/Resources/config/services.php
<?php declare(strict_types=1);

use Swag\BasicExample\Checkout\Cart\Tax\TaxProvider;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;

<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
return static function (ContainerConfigurator $configurator): void {
$services = $configurator->services();

<services>
<service id="Swag\BasicExample\Checkout\Cart\Tax\TaxProvider">
<tag name="shopware.tax.provider" />
</service>
</services>
$services->set(TaxProvider::class)
->tag('shopware.tax.provider');
};
```

## Migrate your tax provider to the database
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -341,14 +341,28 @@

The service definition for our custom renderer would look like this:

```xml
<service id="Swag\BasicExample\Core\Checkout\Document\Render\ExampleDocumentRenderer">
<argument type="service" id="order.repository"/>
<argument type="service" id="Shopware\Core\Checkout\Document\Service\DocumentConfigLoader"/>
<argument type="service" id="Shopware\Core\System\NumberRange\ValueGenerator\NumberRangeValueGeneratorInterface"/>
<argument type="service" id="Shopware\Core\Checkout\Document\Service\DocumentFileRendererRegistry"/>
<tag name="document.renderer"/>
</service>
```php

Check warning on line 344 in guides/plugins/plugins/checkout/document/add-custom-document-type.md

View workflow job for this annotation

GitHub Actions / LanguageTool

[LanguageTool] guides/plugins/plugins/checkout/document/add-custom-document-type.md#L344

File types are normally capitalized. (FILE_EXTENSIONS_CASE[1]) Suggestions: `PHP` URL: https://languagetool.org/insights/post/spelling-capital-letters/ Rule: https://community.languagetool.org/rule/show/FILE_EXTENSIONS_CASE?lang=en-US&subId=1 Category: CASING
Raw output
guides/plugins/plugins/checkout/document/add-custom-document-type.md:344:3: File types are normally capitalized. (FILE_EXTENSIONS_CASE[1])
 Suggestions: `PHP`
 URL: https://languagetool.org/insights/post/spelling-capital-letters/ 
 Rule: https://community.languagetool.org/rule/show/FILE_EXTENSIONS_CASE?lang=en-US&subId=1
 Category: CASING
<?php declare(strict_types=1);

use Shopware\Core\Checkout\Document\Service\DocumentConfigLoader;
Comment thread
mitelg marked this conversation as resolved.
use Shopware\Core\Checkout\Document\Service\DocumentFileRendererRegistry;
use Shopware\Core\System\NumberRange\ValueGenerator\NumberRangeValueGeneratorInterface;
use Swag\BasicExample\Core\Checkout\Document\Render\ExampleDocumentRenderer;

use function Symfony\Component\DependencyInjection\Loader\Configurator\service;

return static function (ContainerConfigurator $configurator): void {
$services = $configurator->services();

$services->set(ExampleDocumentRenderer::class)
->args([
service('order.repository'),
service(DocumentConfigLoader::class),
service(NumberRangeValueGeneratorInterface::class),
service(DocumentFileRendererRegistry::class),
])
->tag('document.renderer');
};
```

### Adding a file type renderer
Expand All @@ -358,26 +372,33 @@

### Registering the renderer in the service container

Now we need to register our custom `ExampleDocumentRenderer` in the service container. Create or update your `services.xml` file:
Now we need to register our custom `ExampleDocumentRenderer` in the service container. Create or update your `services.php` file:

::: code-group

```xml [PLUGIN_ROOT/src/Resources/config/services.xml]
<?xml version="1.0" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">

<services>
<service id="Swag\BasicExample\Core\Checkout\Document\Render\ExampleDocumentRenderer">
<argument type="service" id="order.repository"/>
<argument type="service" id="Shopware\Core\Checkout\Document\Service\DocumentConfigLoader"/>
<argument type="service" id="Shopware\Core\System\NumberRange\ValueGenerator\NumberRangeValueGeneratorInterface"/>
<argument type="service" id="Shopware\Core\Checkout\Document\Service\DocumentFileRendererRegistry"/>
<tag name="document.renderer"/>
</service>
</services>
</container>
```php [PLUGIN_ROOT/src/Resources/config/services.php]

Check warning on line 379 in guides/plugins/plugins/checkout/document/add-custom-document-type.md

View workflow job for this annotation

GitHub Actions / LanguageTool

[LanguageTool] guides/plugins/plugins/checkout/document/add-custom-document-type.md#L379

File types are normally capitalized. (FILE_EXTENSIONS_CASE[1]) Suggestions: `PHP` URL: https://languagetool.org/insights/post/spelling-capital-letters/ Rule: https://community.languagetool.org/rule/show/FILE_EXTENSIONS_CASE?lang=en-US&subId=1 Category: CASING
Raw output
guides/plugins/plugins/checkout/document/add-custom-document-type.md:379:3: File types are normally capitalized. (FILE_EXTENSIONS_CASE[1])
 Suggestions: `PHP`
 URL: https://languagetool.org/insights/post/spelling-capital-letters/ 
 Rule: https://community.languagetool.org/rule/show/FILE_EXTENSIONS_CASE?lang=en-US&subId=1
 Category: CASING
<?php declare(strict_types=1);

use Shopware\Core\Checkout\Document\Service\DocumentConfigLoader;
use Shopware\Core\Checkout\Document\Service\DocumentFileRendererRegistry;
use Shopware\Core\System\NumberRange\ValueGenerator\NumberRangeValueGeneratorInterface;
use Swag\BasicExample\Core\Checkout\Document\Render\ExampleDocumentRenderer;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;

use function Symfony\Component\DependencyInjection\Loader\Configurator\service;

return static function (ContainerConfigurator $configurator): void {
$services = $configurator->services();

$services->set(ExampleDocumentRenderer::class)
->args([
service('order.repository'),
service(DocumentConfigLoader::class),
service(NumberRangeValueGeneratorInterface::class),
service(DocumentFileRendererRegistry::class),
])
->tag('document.renderer');
};
```

:::
Expand Down
Loading
Loading