Skip to content

Commit

Permalink
minor #178 [README] Improve installation guide (lchrusciel)
Browse files Browse the repository at this point in the history
This PR was merged into the 1.1-dev branch.

Discussion
----------

Based on #179

Commits
-------

98441ef [README] Improve installation guide
  • Loading branch information
Zales0123 authored Oct 28, 2021
2 parents 1f5c604 + 98441ef commit 56ce1ea
Showing 1 changed file with 57 additions and 2 deletions.
59 changes: 57 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,63 @@ Symfony Flex, it's much quicker! :)

4. Override repositories

As shown [here](tests/Application/Doctrine/ORM)
and [here](tests/Application/config/packages/_sylius.yaml).
1. Create repository classes
```bash
mkdir src/Repository
touch src/Repository/CustomerRepository.php
touch src/Repository/ProductVariantRepository.php
```
2. Paste the following content to the `src/Repository/CustomerRepository.php`:
```php
<?php
declare(strict_types=1);
namespace App\Repository;
use Sylius\AdminOrderCreationPlugin\Doctrine\ORM\CustomerRepositoryInterface;
use Sylius\AdminOrderCreationPlugin\Doctrine\ORM\CustomerRepositoryTrait;
use Sylius\Bundle\CoreBundle\Doctrine\ORM\CustomerRepository as BaseCustomerRepository;
final class CustomerRepository extends BaseCustomerRepository implements CustomerRepositoryInterface
{
use CustomerRepositoryTrait;
}
```
3. Paste the following content to the `src/Repository/ProductVariantRepository.php`:
```php
<?php
declare(strict_types=1);
namespace App\Repository;
use Sylius\AdminOrderCreationPlugin\Doctrine\ORM\ProductVariantRepositoryInterface;
use Sylius\AdminOrderCreationPlugin\Doctrine\ORM\ProductVariantRepositoryTrait;
use Sylius\Bundle\CoreBundle\Doctrine\ORM\ProductVariantRepository as BaseProductVariantRepository;
final class ProductVariantRepository extends BaseProductVariantRepository implements ProductVariantRepositoryInterface
{
use ProductVariantRepositoryTrait;
}
```
4. Configure repositories in `config/packages/_sylius.yaml`:
```diff
sylius_customer:
resources:
customer:
classes:
model: App\Entity\Customer\Customer
+ repository: App\Repository\CustomerRepository
sylius_product:
resources:
product_variant:
classes:
model: App\Entity\Product\ProductVariant
+ repository: App\Repository\ProductVariantRepository
```


## Extension points

Expand Down

0 comments on commit 56ce1ea

Please sign in to comment.