[Upgrade] Refine Sylius 1.14 upgrade guide

This commit is contained in:
Rafikooo 2024-11-08 03:14:56 +01:00
parent 15c7d3a413
commit 11a51e9e80
No known key found for this signature in database
GPG key ID: 4A26D8327BC2442B

View file

@ -1,6 +1,6 @@
# UPGRADE FROM `v1.13.X` TO `v1.14.0`
### Dependencies
## Dependencies
1. The minimum version of `sylius/resource` and `sylius/resource-bundle` have been bumped to `^1.11`.
Due to that the following namespaces have been updated throughout the codebase:
@ -29,7 +29,7 @@
| `Sylius\Component\Resource\Translation\Provider\TranslationLocaleProviderInterface` | `Sylius\Resource\Translation\Provider\TranslationLocaleProviderInterface` |
| `Sylius\Component\Resource\Translation\TranslatableEntityLocaleAssignerInterface` | `Sylius\Resource\Translation\TranslatableEntityLocaleAssignerInterface` |
The previous namespaces are still usable, but are considered deprecated and may be removed in future versions of `Resource` packages, update them at your own convenience.
The old namespaces are deprecated and may be removed in future versions. Update your code to use the new namespaces.
2. Package `enshrined/svg-sanitize` has been removed from the project due to license incompatibility with Sylius. You can still use it in your project by adding it manually:
@ -43,7 +43,7 @@
allowed_image_mime_types: ['image/jpeg', 'image/png', 'image/gif', 'image/webp', 'image/svg+xml']
```
### Deprecations
## New Service Aliases
1. Aliases for the following services have been introduced to standardize service IDs and will replace the incorrect IDs in Sylius 2.0:
@ -621,14 +621,16 @@
1. Aliases for the following `knp_menu.menu_builder` service tags have been introduced to standardize tag aliases and will replace the incorrect aliases in Sylius 2.0:
| Old Alias | New Alias |
|-----------------------|-----------------------|
| **AdminBundle** | |
| `sylius.admin.main` | `sylius_admin.main` |
| **ShopBundle** | |
| `sylius.shop.account` | `sylius_shop.account` |
| Old Alias | New Alias |
|-----------------------|-----------------------|
| **AdminBundle** | |
| `sylius.admin.main` | `sylius_admin.main` |
| **ShopBundle** | |
| `sylius.shop.account` | `sylius_shop.account` |
The old alias are now deprecated and will be removed in Sylius 2.0.
The old alias are now deprecated and will be removed in Sylius 2.0.
## Service Definition Deprecations
1. The definition of the service `Sylius\Bundle\PromotionBundle\Form\Type\CatalogPromotionAction\PercentageDiscountActionConfigurationType`
in the `PromotionBundle` has been deprecated and will be removed in Sylius 2.0. This definition has been copied to the `CoreBundle`.
@ -639,98 +641,88 @@
1. The following class definitions will be moved to `PromotionBundle` in Sylius 2.0:
- `Sylius\Bundle\PromotionBundle\Form\Type\CatalogPromotionScopeType`
1. The following class will be moved to `ShopBundle` in Sylius 2.0:
- `Sylius\Bundle\CoreBundle\Theme\ChannelBasedThemeContext`
## Classes and Interfaces Deprecations
Starting with this version, form types will be extended using the parent form instead of through form extensions,
like it's done in the `Sylius\Bundle\AdminBundle\Form\Type\CatalogPromotionScopeType` and `Sylius\Bundle\AdminBundle\Form\Type\CatalogPromotionActionType` classes.
| Deprecated class/interface | Will be replaced with |
|----------------------------------------------------------------------|-------------------------------------------------------------------------|
| `Sylius\Bundle\AdminBundle\Provider\StatisticsDataProvider` | `Sylius\Component\Core\Statistics\Provider\StatisticsProvider` |
| `Sylius\Bundle\AdminBundle\Provider\StatisticsDataProviderInterface` | `Sylius\Component\Core\Statistics\Provider\StatisticsProviderInterface` |
| `Sylius\Bundle\CoreBundle\Twig\StateMachineExtension` | `Sylius\Abstraction\StateMachine\Twig\StateMachineExtension` |
1. Classes related to legacy validation of CatalogPromotions' configuration have been deprecated and will be remove in Sylius 2.0:
- `Sylius\Bundle\ApiBundle\Validator\CatalogPromotion\FixedDiscountActionValidator`
- `Sylius\Bundle\ApiBundle\Validator\CatalogPromotion\ForProductsScopeValidator`
- `Sylius\Bundle\ApiBundle\Validator\CatalogPromotion\ForTaxonsScopeValidator`
- `Sylius\Bundle\ApiBundle\Validator\CatalogPromotion\ForVariantsScopeValidator`
- `Sylius\Bundle\ApiBundle\Validator\CatalogPromotion\PercentageDiscountActionValidator`
- `Sylius\Bundle\CoreBundle\CatalogPromotion\Validator\CatalogPromotionAction\FixedDiscountActionValidator`
- `Sylius\Bundle\CoreBundle\CatalogPromotion\Validator\CatalogPromotionScope\ForProductsScopeValidator`
- `Sylius\Bundle\CoreBundle\CatalogPromotion\Validator\CatalogPromotionScope\ForTaxonsScopeValidator`
- `Sylius\Bundle\CoreBundle\CatalogPromotion\Validator\CatalogPromotionScope\ForVariantsScopeValidator`
- `Sylius\Bundle\PromotionBundle\Validator\Constraints\CatalogPromotionAction`
- `Sylius\Bundle\PromotionBundle\Validator\Constraints\CatalogPromotionScope`
Use the regular Symfony validation constraints instead.
1. The class `Sylius\Bundle\CoreBundle\Twig\StateMachineExtension` has been deprecated and will be removed in Sylius 2.0. Use `Sylius\Abstraction\StateMachine\Twig\StateMachineExtension` instead.
1. The class `Sylius\Bundle\CoreBundle\Console\Command\ShowAvailablePluginsCommand` has been deprecated and will be removed in Sylius 2.0.
1. The class `Sylius\Bundle\CoreBundle\Console\Command\Model\PluginInfo` has been deprecated and will be removed in Sylius 2.0.
1. The class `Sylius\Bundle\CoreBundle\Form\EventSubscriber\AddUserFormSubscriber` has been deprecated and will be removed in Sylius 2.0.
1. The class `Sylius\Bundle\AdminBundle\EventListener\ResourceDeleteSubscriber` has been deprecated and will be removed in Sylius 2.0.
It will be replaced with the `ResourceDeleteListener`.
1. The following exceptions have been deprecated and will be removed in Sylius 2.0:
- `Sylius\Bundle\ApiBundle\Exception\CannotRemoveCurrentlyLoggedInUser`
- `Sylius\Bundle\ApiBundle\Exception\ChannelCannotBeRemoved`
- `Sylius\Bundle\ApiBundle\Exception\PaymentMethodCannotBeRemoved`
- `Sylius\Bundle\ApiBundle\Exception\ProductAttributeCannotBeRemoved`
- `Sylius\Bundle\ApiBundle\Exception\ProductCannotBeRemoved`
- `Sylius\Bundle\ApiBundle\Exception\ProductVariantCannotBeRemoved`
- `Sylius\Bundle\ApiBundle\Exception\PromotionCannotBeRemoved`
- `Sylius\Bundle\ApiBundle\Exception\PromotionCouponCannotBeRemoved`
- `Sylius\Bundle\ApiBundle\Exception\ProvinceCannotBeRemoved`
- `Sylius\Bundle\ApiBundle\Exception\ShippingMethodCannotBeRemoved`
- `Sylius\Bundle\ApiBundle\Exception\TaxonCannotBeRemoved`
- `Sylius\Bundle\ApiBundle\Exception\ZoneCannotBeRemoved`
All of these exceptions will be replaced with the `Sylius\Component\Core\Exception\ResourceDeleteException` exception.
### Exceptions
- `Sylius\Bundle\ApiBundle\Exception\CannotRemoveCurrentlyLoggedInUser`
- `Sylius\Bundle\ApiBundle\Exception\ChannelCannotBeRemoved`
- `Sylius\Bundle\ApiBundle\Exception\PaymentMethodCannotBeRemoved`
- `Sylius\Bundle\ApiBundle\Exception\ProductAttributeCannotBeRemoved`
- `Sylius\Bundle\ApiBundle\Exception\ProductCannotBeRemoved`
- `Sylius\Bundle\ApiBundle\Exception\ProductVariantCannotBeRemoved`
- `Sylius\Bundle\ApiBundle\Exception\PromotionCannotBeRemoved`
- `Sylius\Bundle\ApiBundle\Exception\PromotionCouponCannotBeRemoved`
- `Sylius\Bundle\ApiBundle\Exception\ProvinceCannotBeRemoved`
- `Sylius\Bundle\ApiBundle\Exception\ShippingMethodCannotBeRemoved`
- `Sylius\Bundle\ApiBundle\Exception\TaxonCannotBeRemoved`
- `Sylius\Bundle\ApiBundle\Exception\ZoneCannotBeRemoved`
### Classes related to legacy validation of CatalogPromotions. Use the regular Symfony validation constraints instead.
- `Sylius\Bundle\ApiBundle\Validator\CatalogPromotion\FixedDiscountActionValidator`
- `Sylius\Bundle\ApiBundle\Validator\CatalogPromotion\ForProductsScopeValidator`
- `Sylius\Bundle\ApiBundle\Validator\CatalogPromotion\ForTaxonsScopeValidator`
- `Sylius\Bundle\ApiBundle\Validator\CatalogPromotion\ForVariantsScopeValidator`
- `Sylius\Bundle\ApiBundle\Validator\CatalogPromotion\PercentageDiscountActionValidator`
- `Sylius\Bundle\CoreBundle\CatalogPromotion\Validator\CatalogPromotionAction\FixedDiscountActionValidator`
- `Sylius\Bundle\CoreBundle\CatalogPromotion\Validator\CatalogPromotionScope\ForProductsScopeValidator`
- `Sylius\Bundle\CoreBundle\CatalogPromotion\Validator\CatalogPromotionScope\ForTaxonsScopeValidator`
- `Sylius\Bundle\CoreBundle\CatalogPromotion\Validator\CatalogPromotionScope\ForVariantsScopeValidator`
- `Sylius\Bundle\PromotionBundle\Validator\Constraints\CatalogPromotionAction`
- `Sylius\Bundle\PromotionBundle\Validator\Constraints\CatalogPromotionScope`
### Statistics
- `Sylius\Bundle\AdminBundle\Controller\Dashboard\StatisticsController`
- `Sylius\Component\Core\Dashboard\DashboardStatistics`
- `Sylius\Component\Core\Dashboard\DashboardStatisticsProvider`
- `Sylius\Component\Core\Dashboard\DashboardStatisticsProviderInterface`
- `Sylius\Component\Core\Dashboard\Interval`
- `Sylius\Component\Core\Dashboard\SalesDataProvider`
- `Sylius\Component\Core\Dashboard\SalesDataProviderInterface`
- `Sylius\Component\Core\Dashboard\SalesSummary`
- `Sylius\Component\Core\Dashboard\SalesSummaryInterface`
### Templating helpers and its interfaces
- `Sylius\Bundle\CoreBundle\Templating\Helper\CheckoutStepsHelper`
- `Sylius\Bundle\CoreBundle\Templating\Helper\PriceHelper`
- `Sylius\Bundle\CoreBundle\Templating\Helper\VariantResolverHelper`
- `Sylius\Bundle\CurrencyBundle\Templating\Helper\CurrencyHelper`
- `Sylius\Bundle\CurrencyBundle\Templating\Helper\CurrencyHelperInterface`
- `Sylius\Bundle\InventoryBundle\Templating\Helper\InventoryHelper`
- `Sylius\Bundle\LocaleBundle\Templating\Helper\LocaleHelper`
- `Sylius\Bundle\LocaleBundle\Templating\Helper\LocaleHelperInterface`
- `Sylius\Bundle\MoneyBundle\Templating\Helper\ConvertMoneyHelper`
- `Sylius\Bundle\MoneyBundle\Templating\Helper\ConvertMoneyHelperInterface`
- `Sylius\Bundle\MoneyBundle\Templating\Helper\FormatMoneyHelper`
- `Sylius\Bundle\MoneyBundle\Templating\Helper\FormatMoneyHelperInterface`
- `Sylius\Bundle\OrderBundle\Templating\Helper\AdjustmentsHelper`
### Security related classes and interfaces
- `Sylius\Bundle\UserBundle\Security\UserLogin`
- `Sylius\Bundle\UserBundle\Security\UserLoginInterface`
- `Sylius\Bundle\UserBundle\Security\UserPasswordHasher`
- `Sylius\Component\User\Security\UserPasswordHasherInterface`
### Miscellaneous
- `Sylius\Bundle\AddressingBundle\Controller\ProvinceController`
- `Sylius\Bundle\AdminBundle\Controller\NotificationController`
- `Sylius\Bundle\AdminBundle\EventListener\ResourceDeleteSubscriber`
- `Sylius\Bundle\CoreBundle\Console\Command\Model\PluginInfo`
- `Sylius\Bundle\CoreBundle\Console\Command\ShowAvailablePluginsCommand`
- `Sylius\Bundle\CoreBundle\Form\EventSubscriber\AddUserFormSubscriber`
- `Sylius\Bundle\CoreBundle\Theme\ChannelBasedThemeContext`
1. Extending `\InvalidArgumentException` by `Sylius\Component\Core\Inventory\Exception\NotEnoughUnitsOnHandException`
and `Sylius\Component\Core\Inventory\Exception\NotEnoughUnitsOnHoldException` is deprecated, instead they will extend
`\RuntimeException` in Sylius 2.0.
1. Statistics related deprecations:
- The class `Sylius\Bundle\AdminBundle\Provider\StatisticsDataProvider` and interface `Sylius\Bundle\AdminBundle\Provider\StatisticsDataProviderInterface` have been deprecated and will be removed in Sylius 2.0.
Use `Sylius\Component\Core\Statistics\Provider\StatisticsProvider` and `Sylius\Component\Core\Statistics\Provider\StatisticsProviderInterface` instead.
- The class `Sylius\Bundle\AdminBundle\Controller\Dashboard\StatisticsController` has been deprecated and will be removed in Sylius 2.0.
- The route `sylius_admin_dashboard_statistics` has been deprecated and will be removed in Sylius 2.0.
- The class `Sylius\Component\Core\Dashboard\DashboardStatistics` has been deprecated and will be removed in Sylius 2.0.
- The class `Sylius\Component\Core\Dashboard\DashboardStatisticsProvider` and interface `Sylius\Component\Core\Dashboard\DashboardStatisticsProviderInterface` have been deprecated and will be removed in Sylius 2.0.
- The class `Sylius\Component\Core\Dashboard\Interval` has been deprecated and will be removed in Sylius 2.0.
- The class `Sylius\Component\Core\Dashboard\SalesDataProvider` and interface `Sylius\Component\Core\Dashboard\SalesDataProviderInterface` have been deprecated and will be removed in Sylius 2.0.
- The class `Sylius\Component\Core\Dashboard\SalesSummary` and interface `Sylius\Component\Core\Dashboard\SalesSummaryInterface` have been deprecated and will be removed in Sylius 2.0.
1. The following security related classes and interfaces have been deprecated, and they will be removed in 2.0:
- `Sylius\Bundle\UserBundle\Security\UserLogin`
- `Sylius\Bundle\UserBundle\Security\UserLoginInterface`
- `Sylius\Bundle\UserBundle\Security\UserPasswordHasher`
- `Sylius\Bundle\UserBundle\Security\UserPasswordHasherInterface`
1. The following security related services and aliases have been deprecated, and they will be removed in 2.0:
- `sylius.security.password_hasher`
- `sylius.security.user_login`
- `Sylius\Bundle\UserBundle\Security\UserLoginInterface`
- `Sylius\Component\User\Security\UserPasswordHasherInterface`
1. The constructor signature of `Sylius\Bundle\AdminBundle\Action\ResendOrderConfirmationEmailAction` has been changed:
```diff
use Symfony\Component\Routing\RouterInterface;
public function __construct(
private OrderRepositoryInterface $orderRepository,
private OrderEmailManagerInterface|ResendOrderConfirmationEmailDispatcherInterface $orderEmailManager,
private CsrfTokenManagerInterface $csrfTokenManager,
private RequestStack|SessionInterface $requestStackOrSession,
+ private ?RouterInterface $router = null,
)
```
1. The following classes have been deprecated and will be removed in Sylius 2.0:
- **AddressingBundle**
- `Sylius\Bundle\AddressingBundle\Controller\ProvinceController`
1. The following services have been deprecated and will be removed in Sylius 2.0:
- **AdminBundle**
- `Sylius\Bundle\AdminBundle\Controller\NotificationController`
- `sylius.controller.admin.notification`
- `Sylius\Bundle\AdminBundle\Controller\Dashboard\StatisticsController`
- `Sylius\Bundle\AdminBundle\Form\Extension\CatalogPromotionActionTypeExtension`
@ -856,23 +848,25 @@
- `Sylius\Bundle\UiBundle\Twig\TemplateEventExtension`
- `Sylius\Bundle\UiBundle\Twig\TestFormAttributeExtension`
- `Sylius\Bundle\UiBundle\Twig\TestHtmlAttributeExtension`
- **UserBundle**
- `sylius.security.password_hasher`
- `sylius.security.user_login`
1. The following templating helpers and its interfaces have been deprecated and will be removed in Sylius 2.0:
- `Sylius\Bundle\CoreBundle\Templating\Helper\CheckoutStepsHelper`
- `Sylius\Bundle\CoreBundle\Templating\Helper\PriceHelper`
- `Sylius\Bundle\CoreBundle\Templating\Helper\VariantResolverHelper`
- `Sylius\Bundle\CurrencyBundle\Templating\Helper\CurrencyHelper`
- `Sylius\Bundle\CurrencyBundle\Templating\Helper\CurrencyHelperInterface`
- `Sylius\Bundle\InventoryBundle\Templating\Helper\InventoryHelper`
- `Sylius\Bundle\LocaleBundle\Templating\Helper\LocaleHelper`
- `Sylius\Bundle\LocaleBundle\Templating\Helper\LocaleHelperInterface`
- `Sylius\Bundle\MoneyBundle\Templating\Helper\ConvertMoneyHelper`
- `Sylius\Bundle\MoneyBundle\Templating\Helper\ConvertMoneyHelperInterface`
- `Sylius\Bundle\MoneyBundle\Templating\Helper\FormatMoneyHelper`
- `Sylius\Bundle\MoneyBundle\Templating\Helper\FormatMoneyHelperInterface`
- `Sylius\Bundle\OrderBundle\Templating\Helper\AdjustmentsHelper`
## Constructor Signature Changes
1. The following constructor signatures have been changed:
`Sylius\Bundle\AdminBundle\Action\ResendOrderConfirmationEmailAction`
```diff
use Symfony\Component\Routing\RouterInterface;
public function __construct(
private OrderRepositoryInterface $orderRepository,
private OrderEmailManagerInterface|ResendOrderConfirmationEmailDispatcherInterface $orderEmailManager,
private CsrfTokenManagerInterface $csrfTokenManager,
private RequestStack|SessionInterface $requestStackOrSession,
+ private ?RouterInterface $router = null,
)
```
`Sylius\Bundle\CoreBundle\Twig\CheckoutStepsExtension`
```diff
@ -970,7 +964,7 @@
)
```
1. The following routes has been deprecated and will be removed in Sylius 2.0:
## Routes deprecations
- `sylius_admin_ajax_all_product_variants_by_codes`
- `sylius_admin_ajax_all_product_variants_by_phrase`
- `sylius_admin_ajax_customer_group_by_code`
@ -982,9 +976,9 @@
- `sylius_admin_ajax_product_by_name_phrase`
- `sylius_admin_ajax_product_index`
- `sylius_admin_ajax_product_options_by_phrase`
- `sylius_admin_ajax_products_by_phrase`
- `sylius_admin_ajax_product_variants_by_codes`
- `sylius_admin_ajax_product_variants_by_phrase`
- `sylius_admin_ajax_products_by_phrase`
- `sylius_admin_ajax_taxon_by_code`
- `sylius_admin_ajax_taxon_by_name_phrase`
- `sylius_admin_ajax_taxon_leafs`
@ -1018,6 +1012,8 @@
- `sylius_shop_partial_taxon_index_by_code`
- `sylius_shop_partial_taxon_show_by_slug`
## Configuration
1. The `sylius_core.state_machine` configuration parameter is deprecated and will be removed in 2.0.
Use `sylius_state_machine_abstraction.state_machine` instead.
@ -1036,6 +1032,10 @@
* `sylius.{user_type}_user.pin_generator.password_reset`
* `sylius.{user_type}_user.pin_uniqueness_checker.password_reset`
## Miscellaneous
1. Starting with Sylius 1.14, form types will be extended using the parent form instead of through form extensions, like it's done in the `Sylius\Bundle\AdminBundle\Form\Type\CatalogPromotionScopeType` and `Sylius\Bundle\AdminBundle\Form\Type\CatalogPromotionActionType` classes.
### Testing Suite
1. The constructor signature of `Sylius\Component\Core\Test\Services\DefaultChannelFactory` has been changed: