Skip to content

Commit

Permalink
Adding documentation for Entity Overrides
Browse files Browse the repository at this point in the history
It wasn't clear that you have to edit the ProductVariant override as well (since Sylius generates one by default)

refs #76
  • Loading branch information
mamazu authored Nov 30, 2023
1 parent 3199bdb commit 5844094
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,20 @@ brille24_tierprice_bundle:
resource: '@Brille24SyliusTierPricePlugin/Resources/config/routing.yml'
```

* Go into your ProductVariant class and add the following trait and add one method call to the constructor
```php
class ProductVariant
{
use \Brille24\SyliusTierPricePlugin\Traits\TierpricableTrait;
public function __construct() {
// Your contructor here
$this->initTierPriceableTrait() // "Constructor" of the trait
}
}
````
* Finally update the database, install the assets and update the translations:
```sh
bin/console doctrine:schema:update --force
Expand All @@ -38,7 +52,6 @@ bin/console translation:update <locale> --force
```

### Integration
* This bundle overrides the `ProductVariant` class provided by Sylius. If you wish to override the class in your application too, you have to merge the configuration in the bundle's `resource.yml` with your own.
* This bundle decorates the `sylius.calculator.product_variant_price` service. If you wish to change that, you could register a [compiler pass](https://symfony.com/doc/current/service_container/compiler_passes.html).
* This bundle decorates the `sylius.order_processing.order_prices_recalculator` service. If you wish to use your own order processor or change its priority, you could register a [compiler pass](https://symfony.com/doc/current/service_container/compiler_passes.html).

Expand Down

0 comments on commit 5844094

Please sign in to comment.