Skip to content

Commit

Permalink
Fixes in the UPGRADE-1.9 file
Browse files Browse the repository at this point in the history
  • Loading branch information
GSadee committed Feb 10, 2021
1 parent 7465cb2 commit b3e6250
Showing 1 changed file with 58 additions and 44 deletions.
102 changes: 58 additions & 44 deletions UPGRADE-1.9.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@

### Package upgrades

1. `getRootDir` method from `Symfony\Component\HttpKernel\Kernel` has been removed in Symfony 5, please adjust
your `src/Kernel.php` class by using `getProjectDir` method instead.

```diff
- $locator = new FileLocator($this, $this->getProjectDir() . '/src/Resources');
+ $locator = new FileLocator($this, $this->getRootDir() . '/Resources');
```

1. We've removed the support for Symfony's Templating component (which is removed in Symfony 5).

* Remove `templating` from framework's configuration:
Expand Down Expand Up @@ -49,20 +57,52 @@

### New API

1. Add new parameters, new access control configuration and reorder it:
1. Adjust your `config/packages/security.yaml`.

```diff
parameters:
+ sylius.security.new_api_user_account_route: "%sylius.security.new_api_shop_route%/account"
+ sylius.security.new_api_user_account_regex: "^%sylius.security.new_api_user_account_route%"

security:
access_control:
+ - { path: "%sylius.security.new_api_user_account_regex%/.*", role: ROLE_USER }
- - { path: "%sylius.security.new_api_shop_regex%/.*", role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: "%sylius.security.new_api_route%/shop/authentication-token", role: IS_AUTHENTICATED_ANONYMOUSLY }
+ - { path: "%sylius.security.new_api_shop_regex%/.*", role: IS_AUTHENTICATED_ANONYMOUSLY }
```
* Parameters from `config/packages/security.yaml` has been moved to separated bundles.
You may delete them if you are using the default values:

```diff
- parameters:
- sylius.security.admin_regex: "^/%sylius_admin.path_name%"
- sylius.security.api_regex: "^/api/v1"
- sylius.security.shop_regex: "^/(?!%sylius_admin.path_name%|api/.*|api$|media/.*)[^/]++"
- sylius.security.new_api_route: "/api/v2"
- sylius.security.new_api_regex: "^%sylius.security.new_api_route%"
- sylius.security.new_api_admin_route: "%sylius.security.new_api_route%/admin"
- sylius.security.new_api_admin_regex: "^%sylius.security.new_api_admin_route%"
- sylius.security.new_api_shop_route: "%sylius.security.new_api_route%/shop"
- sylius.security.new_api_shop_regex: "^%sylius.security.new_api_shop_route%"
```

* If you are not using the default values, you may need to add and change parameters:

```diff
parameters:
- sylius.security.api_regex: "^/api"
- sylius.security.shop_regex: "^/(?!%sylius_admin.path_name%|new-api|api/.*|api$|media/.*)[^/]++"
- sylius.security.new_api_route: "/new-api"
+ sylius.security.api_regex: "^/api/v1"
+ sylius.security.shop_regex: "^/(?!%sylius_admin.path_name%|api/.*|api$|media/.*)[^/]++"
+ sylius.security.new_api_route: "/api/v2"
+ sylius.security.new_api_user_account_route: "%sylius.security.new_api_shop_route%/account"
+ sylius.security.new_api_user_account_regex: "^%sylius.security.new_api_user_account_route%"
```

* Add new access control configuration and reorder it:

```diff
security:
access_control:
+ - { path: "%sylius.security.new_api_admin_regex%/.*", role: ROLE_API_ACCESS }
- - { path: "%sylius.security.new_api_route%/admin/authentication-token", role: IS_AUTHENTICATED_ANONYMOUSLY }
+ - { path: "%sylius.security.new_api_admin_route%/authentication-token", role: IS_AUTHENTICATED_ANONYMOUSLY }
+ - { path: "%sylius.security.new_api_user_account_regex%/.*", role: ROLE_USER }
- - { path: "%sylius.security.new_api_route%/shop/authentication-token", role: IS_AUTHENTICATED_ANONYMOUSLY }
+ - { path: "%sylius.security.new_api_shop_route%/authentication-token", role: IS_AUTHENTICATED_ANONYMOUSLY }
- - { path: "%sylius.security.new_api_admin_regex%/.*", role: ROLE_API_ACCESS }
- { path: "%sylius.security.new_api_shop_regex%/.*", role: IS_AUTHENTICATED_ANONYMOUSLY }
```

1. Unified API registration path in shop has been changed from `/new-api/shop/register` to `/new-api/shop/customers/`.

Expand Down Expand Up @@ -111,42 +151,14 @@
+ xml_serialization:
```

1. Unified API parameters have been changed in `config/packages/security.yaml` to:

```diff
parameters:
- sylius.security.api_regex: "^/api"
- sylius.security.shop_regex: "^/(?!%sylius_admin.path_name%|new-api|api/.*|api$|media/.*)[^/]++"
- sylius.security.new_api_route: "/new-api"
+ sylius.security.api_regex: "^/api/v1"
+ sylius.security.shop_regex: "^/(?!%sylius_admin.path_name%|api/.*|api$|media/.*)[^/]++"
+ sylius.security.new_api_route: "/api/v2"
```
1. `config/packages/fos_rest.yaml` rules have been changed to:

```diff
```diff -
rules:
- - { path: '^/api/.*', priorities: ['json', 'xml'], fallback_format: json, prefer_extension: true }
+ - { path: '^/api/v1/.*', priorities: ['json', 'xml'], fallback_format: json, prefer_extension: true }
```

1. Parameters from `config/packages/security.yaml` has been moved to separated bundles. You may delete them if you are using the default values

```diff
- parameters:
- sylius.security.admin_regex: "^/%sylius_admin.path_name%"
- sylius.security.api_regex: "^/api/v1"
- sylius.security.shop_regex: "^/(?!%sylius_admin.path_name%|api/.*|api$|media/.*)[^/]++"
- sylius.security.new_api_route: "/api/v2"
- sylius.security.new_api_regex: "^%sylius.security.new_api_route%"
- sylius.security.new_api_admin_route: "%sylius.security.new_api_route%/admin"
- sylius.security.new_api_admin_regex: "^%sylius.security.new_api_admin_route%"
- sylius.security.new_api_shop_route: "%sylius.security.new_api_route%/shop"
- sylius.security.new_api_shop_regex: "^%sylius.security.new_api_shop_route%"
- sylius.security.new_api_user_account_route: "%sylius.security.new_api_shop_route%/account"
- sylius.security.new_api_user_account_regex: "^%sylius.security.new_api_user_account_route%"
```

### Data migrations

1. The `CoreBundle/Migrations/Version20201208105207.php` migration was added which extends existing adjustments with additional details (context).
Expand All @@ -165,10 +177,12 @@
If these are not true, please adjust migration accordingly to your need. To exclude following migration from execution run following code:

```
bin/console doctrine:migrations:version 'CoreBundle/Migrations/Version20201208105207' --add
bin/console doctrine:migrations:version 'Sylius\Bundle\CoreBundle\Migrations\Version20201208105207' --add
```

1. The base of the `Adjustment` class has changed. If you extend your adjustments already(or have them overridden by default, because of Sylius-Standard usage), you should base your Adjustment class on `Sylius\Component\Core\Model\Adjustment` instead of `Sylius\Component\Order\Model\Adjustment`.
1. The base of the `Adjustment` class has changed. If you extend your adjustments already (or have them overridden
by default, because of Sylius-Standard usage), you should base your Adjustment class
on `Sylius\Component\Core\Model\Adjustment` instead of `Sylius\Component\Order\Model\Adjustment`.

```diff
- use Sylius\Component\Order\Model\Adjustment as BaseAdjustment;
Expand Down

0 comments on commit b3e6250

Please sign in to comment.