minor #15947 [Maintenance] Enhance and Reorganize Upgrade Files (Rafikooo)

This PR was merged into the 1.13 branch.

Discussion
----------

| Q               | A                                                            |
|-----------------|--------------------------------------------------------------|
| Branch?         | 1.13 <!-- see the comment below -->                  |
| Bug fix?        | no                                                      |
| New feature?    | no                                                      |
| BC breaks?      | no                                                      |
| Deprecations?   | no<!-- don't forget to update the UPGRADE-*.md file --> |
| License         | MIT                                                          |

To facilitate the transition to Sylius 1.13, we have improved the `UPGRADE` and `UPGRADE-API` files. Changes are now organized by topic, and any missing FCQNs have been added to avoid confusion.

Commits
-------
  [Upgrade] Apply auto-format and minor namespaces and descriptions enhancements
  [Upgrade] Group constructor deprecation changes
  [Upgrade] Move the rest of constructor related deprecations
  [Upgrade] Grup Interfaces and Classes deprecations and changes
  [Upgrade] Group configuration changes
  [Upgrade] Group State Machine changes
  [Upgrade] Move Price History Plugin entry to preconditions step
  [Upgrade] Group translations changes
  [Upgrade] Add miscellaneous section
  [Upgrade] Add missing FSQNs and improve other constructors signature changes descriptions
  [UpgradeAPI] Apply auto-format
  [UpgradeAPI] Group classes signature changes
  [Upgrade] Move SendResetPasswordEmailHandler class changes entry from UpgradeAPI
  [UpgradeAPI] Group endpoints changes
  [UpgradeAPI] Group miscellaneous changes
  [Upgrade] Fix formatting
  [Upgrade] Apply review request changes
  [UpgradeAPI] Apply review request changes
  [Upgrade] Unify the way of describing constructor signatures changes for CoreBundle classes
  [Upgrade] Unify the way of describing constructor signatures changes for AdminBundle classes
  [Upgrade] Unify the way of describing constructor signatures changes for ShopBundle classes
  [Upgrade] Unify the way of describing constructor signature changes for AttributeBundle class
  [Upgrade] Unify the way of describing constructor signatures changes for components' classes
  [Upgrade] Add a note about switching to symfony/clock package
  [Upgrade] Extract the architectural changes section
  [Upgrade] Move non-classes related changes under miscellaneous section
  [Upgrade] Group HTTP related changes
  [Upgrade] Extract dependencies section and apply other minor changes
This commit is contained in:
Jacob Tobiasz 2024-03-11 12:44:49 +01:00 committed by GitHub
commit 900ed08d0a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 955 additions and 575 deletions

File diff suppressed because it is too large Load diff

View file

@ -1,45 +1,13 @@
# UPGRADE FROM `v1.12.x` TO `v1.13.0`
1. All the `:read` serialization groups are now split to `index` and `show`.
By this change, the `:read` serialization group is now deprecated and will no more used in the future.
There is a BC layer that will allow you to use the `:read` serialization group `Sylius\Bundle\ApiBundle\SerializerContextBuilder\ReadOperationContextBuilder` by adding the `read` serialization group to your context.
Inside of this service there are 2 configurable parameters `$skipAddingReadGroup` and `$skipAddingIndexAndShowGroups` that will allow you to skip adding the chosen serialization group to your context.
To configure skipping adding the index and show or read serialization groups to the context, add the following configuration to your `config/packages/_sylius.yaml` file:
ApiBundle is no longer experimental and is now following the same support policy as the rest of Sylius.
```yaml
sylius_api:
serialization_groups:
skip_adding_index_and_show_groups: true
skip_adding_read_group: true
```
### Classes signature changes
1. Sylius serialization groups have been updated with a new prefix of `sylius:some_resource`.
If you extend any of the Sylius resources, you should update your serialization groups to use the new prefix.
Non-prefix serialization groups are deprecated and will be removed in Sylius 2.0.
1. The constructor of `Sylius\Bundle\ApiBundle\Serializer\ChannelDenormalizer` has been changed:
1. The following Command constructor signatures have changed:
`Sylius\Bundle\ApiBundle\Command\Account\ChangeShopUserPassword`:
```diff
public function __construct(
private FactoryInterface $channelPriceHistoryConfigFactory,
+ private FactoryInterface $shopBillingDataFactory
) {
}
```
1. The constructor of `Sylius\Bundle\ApiBundle\EventSubscriber\TaxonDeletionEventSubscriber` has changed:
````diff
public function __construct(
private ChannelRepositoryInterface $channelRepository,
+ private TaxonInPromotionRuleCheckerInterface $taxonInPromotionRuleChecker,
) {
}
````
1. The signature of constructor of `Sylius\Bundle\ApiBundle\Command\Account\ChangeShopUserPassword` command changed:
````diff
public function __construct(
- public ?string $newPassword,
+ public string $newPassword,
@ -47,13 +15,11 @@
+ public string $confirmNewPassword,
- public ?string $currentPassword,
+ public string $currentPassword,
) {
}
````
)
```
1. The constructor signature of `Sylius\Bundle\ApiBundle\Command\Catalog\AddProductReview` changed:
````diff
`Sylius\Bundle\ApiBundle\Command\Catalog\AddProductReview`:
```diff
public function __construct(
- public ?string $title,
+ public string $title,
@ -63,13 +29,11 @@
+ public string $comment,
public string $productCode,
public ?string $email = null,
) {
}
````
)
```
1. The constructor signature of `Sylius\Bundle\ApiBundle\Command\Account\VerifyCustomerAccount` changed:
````diff
`Sylius\Bundle\ApiBundle\Command\Account\VerifyCustomerAccount`:
```diff
public function __construct(
- public $token,
+ public string $token,
@ -77,152 +41,214 @@
+ public ?string $localeCode = null,
) {
}
````
1. The item operation paths for ProductVariantTranslation resource changed:
- `GET /admin/product-variant-translation/{id}` -> `GET /admin/product-variant-translations/{id}`
- `GET /shop/product-variant-translation/{id}` -> `GET /shop/product-variant-translations/{id}`
1. Typo in the constraint validator's alias returned by `Sylius\Bundle\ApiBundle\Validator\Constraints\ChangedItemQuantityInCartValidator::validatedBy` has been fixed.
Previously it was `sylius_api_validator_changed_item_guantity_in_cart` and now it is `sylius_api_validator_changed_item_quantity_in_cart`.
1. The `ApiPlatform\Core\Bridge\Symfony\Bundle\Action\SwaggerUiAction` controller has been removed.
Therefore, the `api_platform.swagger.action.ui` service ID points to the API Platform's `SwaggerUiAction` controller.
1. The following services have been removed:
* `Sylius\Bundle\ApiBundle\Swagger\AdminAuthenticationTokenDocumentationNormalizer`
* `Sylius\Bundle\ApiBundle\Swagger\ShopAuthenticationTokenDocumentationNormalizer`
* `Sylius\Bundle\ApiBundle\Swagger\ProductDocumentationNormalizer`
* `Sylius\Bundle\ApiBundle\Swagger\ProductImageDocumentationNormalizer`
* `Sylius\Bundle\ApiBundle\Swagger\ProductSlugDocumentationNormalizer`
* `Sylius\Bundle\ApiBundle\Swagger\ProductVariantDocumentationNormalizer`
* `Sylius\Bundle\ApiBundle\Swagger\ShippingMethodDocumentationNormalizer`
* `Sylius\Bundle\ApiBundle\Swagger\PathHiderDocumentationNormalizer`
* `Sylius\Bundle\ApiBundle\Swagger\AcceptLanguageHeaderDocumentationNormalizer`
Responsibility of these services has been moved to the corresponding services tagged with `sylius.open_api.modifier`:
* `Sylius\Bundle\ApiBundle\OpenApi\Documentation\AdminAuthenticationTokenDocumentationModifier`
* `Sylius\Bundle\ApiBundle\OpenApi\Documentation\ShopAuthenticationTokenDocumentationModifier`
* `Sylius\Bundle\ApiBundle\OpenApi\Documentation\ProductDocumentationModifier`
* `Sylius\Bundle\ApiBundle\OpenApi\Documentation\ProductImageDocumentationModifier`
* `Sylius\Bundle\ApiBundle\OpenApi\Documentation\ProductSlugDocumentationModifier`
* `Sylius\Bundle\ApiBundle\OpenApi\Documentation\ProductVariantDocumentationModifier`
* `Sylius\Bundle\ApiBundle\OpenApi\Documentation\ShippingMethodDocumentationModifier`
* `Sylius\Bundle\ApiBundle\OpenApi\Documentation\PathHiderDocumentationModifier`
* `Sylius\Bundle\ApiBundle\OpenApi\Documentation\AcceptLanguageHeaderDocumentationModifier`
1. All usages of `ApiPlatform\Core\Api\IriConverterInterface` have been switched to its non-deprecated counterpart `ApiPlatform\Api\IriConverterInterface`.
Due to that, the constructor and usage in the following classes have been changed accordingly:
* `Sylius\Bundle\ApiBundle\Controller\GetProductBySlugAction`
* `Sylius\Bundle\ApiBundle\Controller\UploadAvatarImageAction`
* `Sylius\Bundle\ApiBundle\EventListener\AdminAuthenticationSuccessListener`
* `Sylius\Bundle\ApiBundle\EventListener\AuthenticationSuccessListener`
* `Sylius\Bundle\ApiBundle\Filter\Doctrine\CatalogPromotionChannelFilter`
* `Sylius\Bundle\ApiBundle\Filter\Doctrine\ProductVariantCatalogPromotionFilter`
* `Sylius\Bundle\ApiBundle\Filter\Doctrine\ProductVariantOptionValueFilter`
* `Sylius\Bundle\ApiBundle\Filter\Doctrine\ProductVariantOptionValueFilter`
* `Sylius\Bundle\ApiBundle\Filter\Doctrine\TaxonFilter`
* `Sylius\Bundle\ApiBundle\Serializer\ChannelPriceHistoryConfigDenormalizer`
* `Sylius\Bundle\ApiBundle\Serializer\ProductNormalizer`
* `Sylius\Bundle\ApiBundle\Serializer\ProductVariantNormalizer`
* `Sylius\Bundle\ApiBundle\Serializer\ZoneDenormalizer`
1. The `Sylius\Bundle\ApiBundle\Filter\Doctrine\CatalogPromotionChannelFilter` service and class has been renamed to `Sylius\Bundle\ApiBundle\Filter\Doctrine\ChannelsAwareChannelFilter`.
1. The `sylius.api.product_taxon_filter` filter has been removed and its functionality has been superseded by the `sylius.api.search_filter.taxon.code` filter. The usage stays the same.
1. Update in Translations Handling
The process for creating or updating translations via the API has been refined. Now, the locale for each translation
is determined directly from its key, making the explicit transmission of the `locale` field redundant. Although the API
continues to support the explicit sending of the `locale` field, it is essential that this explicitly sent locale matches
the key in the translation array. In cases of a mismatch between the key and an explicitly sent locale, the API will
respond with a `Sylius\Bundle\ApiBundle\Exception\TranslationLocaleMismatchException`.
```
1. The following Command Handlers constructor signatures have changed:
`Sylius\Bundle\ApiBundle\CommandHandler\Account\SendAccountRegistrationEmailHandler`:
`Sylius\Bundle\ApiBundle\CommandHandler\Account\SendAccountRegistrationEmailHandler`:
```diff
use Sylius\Bundle\CoreBundle\Mailer\AccountRegistrationEmailManagerInterface;
use Sylius\Component\Mailer\Sender\SenderInterface;
public function __construct(
private UserRepositoryInterface $shopUserRepository,
private ChannelRepositoryInterface $channelRepository,
- private SenderInterface $emailSender,
+ private Sylius\Bundle\CoreBundle\Mailer\AccountRegistrationEmailManagerInterface $accountRegistrationEmailManager,
) {
}
+ private AccountRegistrationEmailManagerInterface $accountRegistrationEmailManager,
)
```
`Sylius\Bundle\ApiBundle\CommandHandler\Account\SendAccountVerificationEmailHandler`:
`Sylius\Bundle\ApiBundle\CommandHandler\Account\SendAccountVerificationEmailHandler`:
```diff
use Sylius\Bundle\CoreBundle\Mailer\AccountVerificationEmailManagerInterface;
use Sylius\Component\Mailer\Sender\SenderInterface;
public function __construct(
private UserRepositoryInterface $shopUserRepository,
private ChannelRepositoryInterface $channelRepository,
- private SenderInterface $emailSender,
+ private Sylius\Bundle\CoreBundle\Mailer\AccountVerificationEmailManagerInterface $accountVerificationEmailManager,
) {
}
+ private AccountVerificationEmailManagerInterface $accountVerificationEmailManager,
)
```
`Sylius\Bundle\ApiBundle\CommandHandler\Account\SendResetPasswordEmailHandler`:
`Sylius\Bundle\ApiBundle\CommandHandler\Account\SendResetPasswordEmailHandler`:
```diff
use Sylius\Bundle\CoreBundle\Mailer\ResetPasswordEmailManagerInterface;
use Sylius\Component\Mailer\Sender\SenderInterface;
public function __construct(
- private SenderInterface $emailSender,
private UserRepositoryInterface $shopUserRepository,
private ChannelRepositoryInterface $channelRepository,
+ private Sylius\Bundle\CoreBundle\Mailer\ResetPasswordEmailManagerInterface $resetPasswordEmailManager,
) {
}
+ private ResetPasswordEmailManagerInterface $resetPasswordEmailManager,
)
```
`Sylius\Bundle\ApiBundle\CommandHandler\Checkout\SendOrderConfirmationHandler`:
`Sylius\Bundle\ApiBundle\CommandHandler\Checkout\SendOrderConfirmationHandler`:
```diff
use Sylius\Bundle\CoreBundle\Mailer\OrderEmailManagerInterface;
use Sylius\Component\Mailer\Sender\SenderInterface;
public function __construct(
- private SenderInterface $emailSender,
private OrderRepositoryInterface $orderRepository,
+ private Sylius\Bundle\CoreBundle\Mailer\OrderEmailManagerInterface $orderEmailManager,
) {
}
+ private OrderEmailManagerInterface $orderEmailManager,
)
```
`Sylius\Bundle\ApiBundle\CommandHandler\Checkout\SendShipmentConfirmationEmailHandler`:
`Sylius\Bundle\ApiBundle\CommandHandler\Checkout\SendShipmentConfirmationEmailHandler`:
```diff
use Sylius\Bundle\CoreBundle\Mailer\ShipmentEmailManagerInterface;
use Sylius\Component\Mailer\Sender\SenderInterface;
public function __construct(
- private SenderInterface $emailSender,
private ShipmentRepositoryInterface $shipmentRepository,
+ private Sylius\Bundle\CoreBundle\Mailer\ShipmentEmailManagerInterface $shipmentEmailManager,
) {
}
+ private ShipmentEmailManagerInterface $shipmentEmailManager,
)
```
`Sylius\Bundle\ApiBundle\CommandHandler\SendContactRequestHandler`:
`Sylius\Bundle\ApiBundle\CommandHandler\SendContactRequestHandler`:
```diff
use Sylius\Bundle\CoreBundle\Mailer\ContactEmailManagerInterface;
use Sylius\Component\Mailer\Sender\SenderInterface;
public function __construct(
- private SenderInterface $emailSender,
private ChannelRepositoryInterface $channelRepository,
+ private Sylius\Bundle\CoreBundle\Mailer\ContactEmailManagerInterface $contactEmailManager,
) {
}
+ private ContactEmailManagerInterface $contactEmailManager,
)
```
`Sylius\Bundle\CoreBundle\MessageHandler\Admin\Account\SendResetPasswordEmailHandler`:
```diff
1. The constructor signature of `Sylius\Bundle\ApiBundle\Serializer\ChannelDenormalizer` has been changed:
```diff
use Sylius\Component\Resource\Factory\FactoryInterface;
public function __construct(
private UserRepositoryInterface $shopUserRepository,
- private SenderInterface $emailSender,
+ private Sylius\Bundle\CoreBundle\Mailer\ResetPasswordEmailManagerInterface $resetPasswordEmailManager,
) {
}
private FactoryInterface $channelPriceHistoryConfigFactory,
+ private FactoryInterface $shopBillingDataFactory
)
```
1. Disabled product and taxon editing at `/admin/product-taxons/{id}` operation to improve data integrity. To modify a productTaxon, remove the existing association and create a new one.
1. The constructor signature of `Sylius\Bundle\ApiBundle\EventSubscriber\TaxonDeletionEventSubscriber` has been changed:
1. The keys for adjustment endpoints' responses have been changed from `order_item` to `orderItem` and `order_item_unit` to `orderItemUnit`.
```diff
use Sylius\Component\Core\Promotion\Checker\TaxonInPromotionRuleCheckerInterface;
public function __construct(
private ChannelRepositoryInterface $channelRepository,
+ private TaxonInPromotionRuleCheckerInterface $taxonInPromotionRuleChecker,
)
```
1. The `Sylius\Bundle\ApiBundle\ApiPlatform\Bridge\Symfony\Bundle\Action\SwaggerUiAction` controller has been removed.
Therefore, the `api_platform.swagger.action.ui` service ID points to the API Platform's `SwaggerUiAction` controller.
1. The following services have been removed:
* `Sylius\Bundle\ApiBundle\Swagger\AdminAuthenticationTokenDocumentationNormalizer`
* `Sylius\Bundle\ApiBundle\Swagger\ShopAuthenticationTokenDocumentationNormalizer`
* `Sylius\Bundle\ApiBundle\Swagger\ProductDocumentationNormalizer`
* `Sylius\Bundle\ApiBundle\Swagger\ProductImageDocumentationNormalizer`
* `Sylius\Bundle\ApiBundle\Swagger\ProductSlugDocumentationNormalizer`
* `Sylius\Bundle\ApiBundle\Swagger\ProductVariantDocumentationNormalizer`
* `Sylius\Bundle\ApiBundle\Swagger\ShippingMethodDocumentationNormalizer`
* `Sylius\Bundle\ApiBundle\Swagger\PathHiderDocumentationNormalizer`
* `Sylius\Bundle\ApiBundle\Swagger\AcceptLanguageHeaderDocumentationNormalizer`
Responsibility of these services has been moved to the corresponding services tagged with `sylius.open_api.modifier`:
* `Sylius\Bundle\ApiBundle\OpenApi\Documentation\AdminAuthenticationTokenDocumentationModifier`
* `Sylius\Bundle\ApiBundle\OpenApi\Documentation\ShopAuthenticationTokenDocumentationModifier`
* `Sylius\Bundle\ApiBundle\OpenApi\Documentation\ProductDocumentationModifier`
* `Sylius\Bundle\ApiBundle\OpenApi\Documentation\ProductImageDocumentationModifier`
* `Sylius\Bundle\ApiBundle\OpenApi\Documentation\ProductSlugDocumentationModifier`
* `Sylius\Bundle\ApiBundle\OpenApi\Documentation\ProductVariantDocumentationModifier`
* `Sylius\Bundle\ApiBundle\OpenApi\Documentation\ShippingMethodDocumentationModifier`
* `Sylius\Bundle\ApiBundle\OpenApi\Documentation\PathHiderDocumentationModifier`
* `Sylius\Bundle\ApiBundle\OpenApi\Documentation\AcceptLanguageHeaderDocumentationModifier`
1. All usages of `ApiPlatform\Core\Api\IriConverterInterface` have been switched to its non-deprecated
counterpart `ApiPlatform\Api\IriConverterInterface`.
Due to that, the constructor and usage in the following classes have been changed accordingly:
* `Sylius\Bundle\ApiBundle\Controller\GetProductBySlugAction`
* `Sylius\Bundle\ApiBundle\Controller\UploadAvatarImageAction`
* `Sylius\Bundle\ApiBundle\EventListener\AdminAuthenticationSuccessListener`
* `Sylius\Bundle\ApiBundle\EventListener\AuthenticationSuccessListener`
* `Sylius\Bundle\ApiBundle\Filter\Doctrine\CatalogPromotionChannelFilter`
* `Sylius\Bundle\ApiBundle\Filter\Doctrine\ProductVariantCatalogPromotionFilter`
* `Sylius\Bundle\ApiBundle\Filter\Doctrine\ProductVariantOptionValueFilter`
* `Sylius\Bundle\ApiBundle\Filter\Doctrine\ProductVariantOptionValueFilter`
* `Sylius\Bundle\ApiBundle\Filter\Doctrine\TaxonFilter`
* `Sylius\Bundle\ApiBundle\Serializer\ChannelPriceHistoryConfigDenormalizer`
* `Sylius\Bundle\ApiBundle\Serializer\ProductNormalizer`
* `Sylius\Bundle\ApiBundle\Serializer\ProductVariantNormalizer`
* `Sylius\Bundle\ApiBundle\Serializer\ZoneDenormalizer`
1. The `Sylius\Bundle\ApiBundle\Filter\Doctrine\CatalogPromotionChannelFilter` service and class has been renamed
to `Sylius\Bundle\ApiBundle\Filter\Doctrine\ChannelsAwareChannelFilter`.
### Resources changes
1. The item operation path for ProductVariantTranslation resource has been changed:
- `GET` `/admin/product-variant-translation/{id}` -> `GET` `/admin/product-variant-translations/{id}`
1. The following shop endpoints for getting the translation resources have been removed:
* `GET `/shop/taxon-translations/{id}`
* `GET `/shop/product-translations/{id}`
* `GET `/shop/product-variant-translations/{id}`
* `GET `/shop/shipping-method-translations/{id}`
* `GET` `/shop/taxon-translations/{id}`
* `GET` `/shop/product-translations/{id}`
* `GET` `/shop/product-variant-translations/{id}`
* `GET` `/shop/shipping-method-translations/{id}`
The fields those endpoint were exposing are available on their respective translation subject resources.
The fields those endpoint were exposing are available on their respective translation subject resources.
1. Update in Translations Handling
The process for creating or updating translations via the API has been refined. Now, the locale for each translation
is determined directly from its key, making the explicit transmission of the `locale` field redundant. Although the
API continues to support the explicit sending of the `locale` field but in cases of a mismatch between the key and an
explicitly sent locale, the API will respond with
the `Sylius\Bundle\ApiBundle\Exception\TranslationLocaleMismatchException`.
1. Product and taxon editing at `/admin/product-taxons/{id}` operation has been disabled to improve data integrity. To
modify a product-taxon relationship remove the existing one and create a new one.
1. The keys for adjustment endpoints' responses have been changed:
```diff
{
...
- "order_item": "string",
+ "orderItem": "string",
- "order_item_unit": "string",
+ "orderItemUnit": "string",
...
}
```
### Miscellaneous
1. All the `:read` serialization groups are now split to `index` and `show`.
The `:read` serialization groups are now considered deprecated and will no longer be used in the future.
There is a BC layer that will allow you to use the `:read` serialization
group `Sylius\Bundle\ApiBundle\SerializerContextBuilder\ReadOperationContextBuilder` by adding the `read`
serialization group to your context.
To configure skipping adding the index and show or read serialization groups to the context, add the following
configuration to your `config/packages/_sylius.yaml` file:
```yaml
sylius_api:
serialization_groups:
skip_adding_index_and_show_groups: true
skip_adding_read_group: true
```
1. All Sylius serialization groups have been prefixed with `sylius:`.
If you extend any Sylius resources, you should update your serialization groups to use the new prefix.
Non-prefix serialization groups are considered deprecated and will be removed in Sylius 2.0.
1. Typo in the constraint validator's alias returned
by `Sylius\Bundle\ApiBundle\Validator\Constraints\ChangedItemQuantityInCart::validatedBy` has been fixed.
Previously it was `sylius_api_validator_changed_item_guantity_in_cart` and now it
is `sylius_api_validator_changed_item_quantity_in_cart`.
1. The `sylius.api.product_taxon_filter` filter has been removed and its functionality has been superseded by
the `sylius.api.search_filter.taxon.code` filter. The usage stays the same.