Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update installation.md #97

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 35 additions & 21 deletions doc/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,22 @@

```php
return [
...

// ...
BitBag\SyliusVueStorefront2Plugin\BitBagSyliusVueStorefront2Plugin::class => ['all' => true],
BitBag\SyliusWishlistPlugin\BitBagSyliusWishlistPlugin::class => ['all' => true],
];
```
![Step](/doc/images/Step2.png)

3. Enable API
3. Add plugin config and enable API
In `config/packages/_sylius.yaml`
```yaml
sylius_api:
enabled: true
imports:
# ...
- { resource: "@BitBagSyliusVueStorefront2Plugin/Resources/config/config.yml" }

sylius_api:
enabled: true
```
![Step3](/doc/images/Step3.png)

Expand Down Expand Up @@ -56,7 +59,7 @@

imports:
- { resource: "@BitBagSyliusVueStorefront2Plugin/Resources/config/services.xml" }
```
```

There are 2 plugin parameters that You can adjust:

Expand All @@ -66,6 +69,15 @@
```
![Step6](/doc/images/Step6.png)

7. Import required config by adding `config/packages/bitbag_sylius_vue_storefront2_plugin.yaml` file:

```yaml
# config/packages/gesdinet_jwt_refresh_token.yaml

gesdinet_jwt_refresh_token:
refresh_token_class: BitBag\SyliusVueStorefront2Plugin\Model\RefreshToken
```

7. Add doctrine mapping to your `config/packages/doctrine.yaml` file:

```yml
Expand All @@ -81,17 +93,6 @@
```
![Step7](/doc/images/Step7.png)

8. In _sylius.yaml add mappings for product attribute and taxonomy repository so graphql can see them properly

```yml
sylius_taxonomy:
resources:
taxon:
classes:
repository: BitBag\SyliusVueStorefront2Plugin\Doctrine\Repository\TaxonRepository
```
![Step8](/doc/images/Step8.png)

9. If you're already extending Sylius' `ProductAttributeValue` entity, please use our trait - `BitBag\SyliusVueStorefront2Plugin\Model\ProductAttributeValueTrait`, inside your own `ProductAttributeValue` entity. If you're not extending `ProductAttributeValue`, please create an entity, which uses the trait and setup the Sylius resource in _sylius.yaml:

```yml
Expand All @@ -102,7 +103,7 @@
subject: Sylius\Component\Core\Model\Product
attribute_value:
classes:
model: App\Entity\ProductAttributeValue
model: App\Entity\Product\ProductAttributeValue
```

10. Please add the Doctrine mapping configuration into your project:
Expand All @@ -128,14 +129,27 @@ If you are using xml mapping:

**Please change the `name` attribute to fit your entity name. If you've already the `ProductAttributeValue` mapping in your project, just add there the `<index>` part of mapping above.**

If you are using annotations:
You can also use annotations. Additionally use ProductAttributeValueTrait.

```php
namespace App\Entity\Product;

use Doctrine\ORM\Mapping as ORM;
use Doctrine\ORM\Mapping\Index;
use Sylius\Component\Product\Model\ProductAttributeValue as BaseProductAttributeValue;
use BitBag\SyliusVueStorefront2Plugin\Model\ProductAttributeValueTrait;

```
/**
* @ORM\Entity
* @ORM\Table(name="sylius_product_attribute_value",indexes={@Index(name="locale_code", columns={"locale_code"})})
* @ORM\Table(name="sylius_product_attribute_value")
* @ORM\Table(name="sylius_product_attribute_value", indexes={@Index(name="locale_code", columns={"locale_code"})})
*/
class ProductAttributeValue extends BaseProductAttributeValue
{
use ProductAttributeValueTrait;
}
```

![Step10](/doc/images/Step9-10.png)

11. Import routing in `config/routes.yaml`
Expand Down