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

Fixes in the UPGRADE-1.9 file #12326

Merged
merged 3 commits into from
Feb 10, 2021
Merged
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
115 changes: 71 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. Add new bundles to your list of used bundles in `config/bundles.php` if they are not already there:

```diff
+ BabDev\PagerfantaBundle\BabDevPagerfantaBundle::class => ['all' => true],
+ SyliusLabs\Polyfill\Symfony\Security\Bundle\SyliusLabsPolyfillSymfonySecurityBundle::class => ['all' => true],

1. Remove `getContainerLoader` method from `src/Kernel.php` class if you did not customise it.

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 @@ -47,23 +55,68 @@
1. `/new-api` prefix has been changed to `/api/v2`. Please adjust your routes accordingly.
Admin API is hardcoded to `/api/v1` instead of `/api/v{version}`.

### New API

1. Add new parameters, new access control configuration and reorder it:
1. Add proper redirect to changing password page in your `config/routes/sylius_shop.yaml` file:

```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 }
+ # see https://web.dev/change-password-url/
+ sylius_shop_request_password_reset_token_redirect:
+ path: /.well-known/change-password
+ methods: [GET]
+ controller: Symfony\Bundle\FrameworkBundle\Controller\RedirectController::redirectAction
+ defaults:
+ route: sylius_shop_request_password_reset_token
+ permanent: false
Comment on lines +61 to +68
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if this route shouldn't be placed in SyliusShopBundle instead of config/routes/sylius_shop.yaml, but there will be probably a problem with prefixes

```

### New API

1. Adjust your `config/packages/security.yaml`.

* 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/`.

1. Identifier needed to retrieve a product in shop API endpoint (`/new-api/shop/products/{id}`) has been changed from `slug` to `code`.
Expand Down Expand Up @@ -111,42 +164,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 +190,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