14 KiB
UPGRADE FROM 1.14 TO 2.0
Codebase
-
The following classes were removed:
Sylius\Bundle\ApiBundle\EventListener\PostgreSQLDriverExceptionListener
-
The following services were removed:
sylius.listener.api_postgresql_driver_exception_listener
-
Non-prefix serialization groups in Sylius resources have been removed. If you have extended any of them, you must prefix them with
sylius:, for example:- #[Groups(['admin:product:index'])] + #[Groups(['sylius:admin:product:index'])] -
API Platform has dropped
DataProvidersandDataPersistersin favor ofProvidersandProcessors, respectively. Due to this change, Sylius customDataProvidersandDataPersistershave been adapted to the new API Platform interfaces and their namespaced have been changed toStateProviderandStateProcessorrespectively:
Sylius\Bundle\ApiBundle\DataPersister\*DataPersister=>Sylius\Bundle\ApiBundle\StateProcessor\*ProcessorSylius\Bundle\ApiBundle\DataProvider\*DataProvider=>Sylius\Bundle\ApiBundle\StateProvider\*Provider
- API Platform has also dropped
DataTransformersin favor of whichsome of themhave been refactored intoSerializerContextBuildersas follows:
Sylius\Bundle\ApiBundle\DataTransformer\ChannelCodeAwareInputCommandDataTransformer=>Sylius\Bundle\ApiBundle\SerializerContextBuilder\ChannelCodeAwareContextBuilderSylius\Bundle\ApiBundle\DataTransformer\LocaleCodeAwareInputCommandDataTransformer=>Sylius\Bundle\ApiBundle\SerializerContextBuilder\LocaleCodeAwareContextBuilderSylius\Bundle\ApiBundle\DataTransformer\LoggedInCustomerEmailIfNotSetAwareCommandDataTransformer=>Sylius\Bundle\ApiBundle\SerializerContextBuilder\LoggedInCustomerEmailIfNotSetAwareContextBuilderSylius\Bundle\ApiBundle\DataTransformer\LoggedInShopUserIdAwareCommandDataTransformer=>Sylius\Bundle\ApiBundle\SerializerContextBuilder\ChannelCodeAwareContextBuilder
- The constructor of
Sylius\Bundle\ApiBundle\Command\Account\RegisterShopUserhas been changed:
public function __construct(
- public string $firstName,
- public string $lastName,
- public string $email,
- public string $password,
- public bool $subscribedToNewsletter = false,
+ protected string $firstName,
+ protected string $lastName,
+ protected string $email,
+ protected string $password,
+ protected ?string $channelCode,
+ protected ?string $localeCode,
+ protected bool $subscribedToNewsletter = false,
) {
}
- The constructor of
Sylius\Bundle\ApiBundle\Command\Account\RequestResetPasswordTokenhas been changed:
public function __construct(
- public string $email,
+ protected string $email,
+ protected ?string $channelCode,
+ protected ?string $localeCode,
) {
}
- The constructor of
Sylius\Bundle\ApiBundle\Command\SendContactRequesthas been changed:
public function __construct(
- private ?string $email = null,
- private ?string $message = null,
+ protected ?string $channelCode,
+ protected ?string $localeCode,
+ protected ?string $email = null,
+ protected ?string $message = null,
) {
}
- The constructor of
Sylius\Bundle\ApiBundle\Command\Account\VerifyShopUserhas been changed:
public function __construct(
- public string $token,
- private ?string $localeCode = null,
- private ?string $channelCode = null,
+ protected string $token,
+ protected string $channelCode,
+ protected string $localeCode,
) {
}
- The constructor of
Sylius\Bundle\ApiBundle\Command\Account\ChangeShopUserPasswordhas been changed:
public function __construct(
- public ?string $newPassword,
- public ?string $confirmNewPassword,
- public ?string $currentPassword,
+ protected mixed $shopUserId,
+ protected string $newPassword,
+ protected string $confirmNewPassword,
+ protected string $currentPassword,
) {
}
- The constructor of
Sylius\Bundle\ApiBundle\Command\Account\RequestShopUserVerificationhas been created:
public function __construct(
+ protected string|int|null $shopUserId,
+ protected ?string $channelCode,
+ protected ?string $localeCode,
) {
}
All the setter methods have been removed from the commands above and also there are some new getter methods accordingly to arguments visibility changes.
- The parameter type and order of the
Sylius\Bundle\ApiBundle\Controller\UploadAvatarImageAction::__constructhas been changed:
public function __construct(
private FactoryInterface $avatarImageFactory,
private AvatarImageRepositoryInterface $avatarImageRepository,
- private ImageUploaderInterface $imageUploader,
- private IriConverterInterface $iriConverter,
+ private RepositoryInterface $adminUserRepository,
+ private ImageUploaderInterface $imageUploader,
)
-
The
getCurrentPrefixmethod has been removed from theSylius\Bundle\ApiBundle\Provider\PathPrefixProviderInterface. -
The
Sylius\Bundle\ApiBundle\Provider\PathPrefixProviderconstructor has been changed due to refactor. Now, we provide the list of possible prefixes that we check in this service. This list can be set under the parameter:sylius.api_path_prefixes.public function __construct( - private UserContextInterface $userContext, private string $apiRoute, + private array $pathPrefixes, ) { ... } -
The signature of method
applyToCollectionof the following classes has been changed:Sylius\Bundle\ApiBundle\Doctrine\QueryCollectionExtension\AcceptedProductReviewsExtensionSylius\Bundle\ApiBundle\Doctrine\QueryCollectionExtension\AddressesExtensionSylius\Bundle\ApiBundle\Doctrine\QueryCollectionExtension\AvailableProductAssociationsInProductCollectionExtensionSylius\Bundle\ApiBundle\Doctrine\QueryCollectionExtension\CountryCollectionExtensionSylius\Bundle\ApiBundle\Doctrine\QueryCollectionExtension\CurrencyCollectionExtensionSylius\Bundle\ApiBundle\Doctrine\QueryCollectionExtension\EnabledProductVariantsExtensionSylius\Bundle\ApiBundle\Doctrine\QueryCollectionExtension\HideArchivedShippingMethodExtensionSylius\Bundle\ApiBundle\Doctrine\QueryCollectionExtension\LocaleCollectionExtensionSylius\Bundle\ApiBundle\Doctrine\QueryCollectionExtension\OrdersByChannelExtensionSylius\Bundle\ApiBundle\Doctrine\QueryCollectionExtension\OrdersByLoggedInUserExtensionSylius\Bundle\ApiBundle\Doctrine\QueryCollectionExtension\ProductsByChannelAndLocaleCodeExtensionSylius\Bundle\ApiBundle\Doctrine\QueryCollectionExtension\ProductsByTaxonExtensionSylius\Bundle\ApiBundle\Doctrine\QueryCollectionExtension\ProductsWithEnableFlagExtensionSylius\Bundle\ApiBundle\Doctrine\QueryCollectionExtension\ProductsWithEnableFlagExtensionSylius\Bundle\ApiBundle\Doctrine\QueryCollectionExtension\RestrictingFilterEagerLoadingExtensionSylius\Bundle\ApiBundle\Doctrine\QueryCollectionExtension\TaxonCollectionExtension
public function applyToCollection(
QueryBuilder $queryBuilder,
QueryNameGeneratorInterface $queryNameGenerator,
string $resourceClass,
- string $operationName = null,
+ \ApiPlatform\Metadata\Operation $operation = null,
array $context = [],
): void;
-
The
Sylius\Bundle\ApiBundle\OpenApi\Documentation\PathHiderDocumentationModifierclass and service have been removed. Thesylius.api.paths_to_hideparameter used in this class has also been removed. We recommend defining endpoints with theApiPlatform\Metadata\NotExposedclass to hide specific operations. -
The following parameters have been renamed:
Old parameter New parameter sylius.security.new_api_routesylius.security.api_routesylius.security.new_api_regexsylius.security.api_regexsylius.security.new_api_admin_routesylius.security.api_admin_routesylius.security.new_api_admin_regexsylius.security.api_admin_regexsylius.security.new_api_shop_routesylius.security.api_shop_routesylius.security.new_api_shop_regexsylius.security.api_shop_regexsylius.security.new_api_user_account_routesylius.security.api_shop_account_routesylius.security.new_api_user_account_regexsylius.security.api_shop_account_regex
-
The following configuration parameters have been removed:
sylius_api.legacy_error_handlingsylius_api.serialization_groups.skip_adding_read_groupsylius_api.serialization_groups.skip_adding_index_and_show_groups
Resource configuration changes
Updated API Routes
- AvatarImage
'GET' - /api/v2/admin/avatar-images/{id}→'GET' - /api/v2/admin/administrators/{id}/avatar-image'POST' - /api/v2/admin/avatar-images→'POST' - /api/v2/admin/administrators/{id}/avatar-image'DELETE' - /api/v2/admin/avatar-images/{id}→'DELETE' - /api/v2/admin/administrators/{id}/avatar-image
- ShopUser, CustomerPassword and CustomerVerification
'POST' - /api/v2/shop/reset-password-requests→'POST' - /api/v2/shop/reset-password'PATCH' - /api/v2/shop/reset-password-requests/{resetPasswordToken}→'PATCH' - /api/v2/shop/reset-password/{resetPasswordToken}'POST' - /api/v2/shop/account-verification-requests→'POST' - /api/v2/shop/verify-shop-user'PATCH' - /api/v2/shop/account-verification-requests/{token}→'PATCH' - /api/v2/shop/verify-shop-user/{token}
- AdminUserPassword
'POST' - /api/v2/admin/reset-password-requests→'POST' - /api/v2/admin/reset-password'PATCH' - /api/v2/admin/reset-password-requests/{resetPasswordToken}→'PATCH' - /api/v2/admin/reset-password/{resetPasswordToken}
- CatalogPromotion
'GET' - /api/v2/admin/catalog-promotion-actions/{id}→'GET' - /api/v2/admin/catalog-promotions/{code}/actions/{id}'GET' - /api/v2/admin/catalog-promotion-scopes/{id}→'GET' - /api/v2/admin/catalog-promotions/{code}/scopes/{id}
- Translation
'GET' - /api/v2/admin/[resource]-translations/{id}→'GET' - /api/v2/admin/[resource]/{code}/translations/{localeCode}
- ChannelPricing
'GET' - /api/v2/admin/channel-pricings/{id}→'GET' - /api/v2/admin/product-variants/{code}/pricing/{id}
- Order
'GET' - /api/v2/admin/order-items/{id}→'GET' - /api/v2/admin/orders/{orderToken}/items/{id}
- Payment
'GET' - /api/v2/shop/payments/{id}→'GET' - /api/v2/shop/orders/{orderToken}/payments/{id}
- Product
'GET' - /api/v2/admin/product-images/{id}→'GET' - /api/v2/admin/products/{code}/images/{id}'GET' - /api/v2/admin/products-images→'GET' - /api/v2/admin/products/{code}/images'GET' - /api/v2/shop/product-images/{id}→'GET' - /api/v2/shop/products/{code}/images/{id}'GET' - /api/v2/admin/product-option-values/{code}→'GET' - /api/v2/admin/product-options/{optionCode}/values/{code}'GET' - /api/v2/shop/product-option-values/{code}→'GET' - /api/v2/shop/product-options/{optionCode}/values/{code}
- Promotion
'GET' - /api/v2/admin/promotion-actions/{id}→'GET' - /api/v2/admin/promotions/{code}/actions/{id}'GET' - /api/v2/admin/promotion-coupons/{id}→'GET' - /api/v2/admin/promotions/{code}/coupons/{id}'POST' - /api/v2/admin/promotion-coupons/generate→'POST' - /api/v2/admin/promotions/{promotionCode}/coupons/generate'PUT' - /api/v2/admin/promotion-coupons/{code}→'PUT' - /api/v2/admin/promotions/{promotionCode}/coupons/{couponCode}'DELETE' - /api/v2/admin/promotion-coupons/{code}→'DELETE' - /api/v2/admin/promotions/{promotionCode}/coupons/{couponCode}'GET' - /api/v2/admin/promotion-rules/{id}→'GET' - /api/v2/admin/promotions/{code}/rules/{id}
- Provinces
'GET' - /api/v2/admin/provinces/{code}→'GET' - /api/v2/admin/countries/{countryCode}/provinces/{provinceCode}'PUT' - /api/v2/admin/provinces/{code}→'PUT' - /api/v2/admin/countries/{countryCode}/provinces/{provinceCode}'GET' - /api/v2/shop/provinces/{code}→'GET' - /api/v2/shop/countries/{countryCode}/provinces/{provinceCode}
- Shipment
'GET' - /api/v2/shop/shipments/{id}→'GET' - /api/v2/shop/orders/{orderToken}/shipments/{id}
- Taxon
'GET' - /api/v2/admin/taxon-images/{id}→'GET' - /api/v2/admin/taxons/{code}/images/{id}'POST' - /api/v2/admin/taxon-images→'POST' - /api/v2//admin/taxons/{code}/images'PUT' - /api/v2/admin/taxon-images/{id}→'PUT' - /api/v2/admin/taxons/{code}/images/{id}'DELETE' - /api/v2/admin/taxon-images/{id}→'DELETE' - /api/v2/admin/taxons/{code}/images/{id}'GET' - /api/v2/shop/taxon-images/{id}→'GET' - /api/v2/shop/taxons/{code}/images/{id}
Other Resource Changes
-
Adjustment
- The shop item endpoint is no longer exposed.
-
CustomerVerification
Sylius\Bundle\ApiBundle\Command\Account\VerifyCustomerAccountcommand has been renamed toSylius\Bundle\ApiBundle\Command\Account\VerifyShopUser.Sylius\Bundle\ApiBundle\Command\Account\ResendVerificationEmailcommand has been renamed toSylius\Bundle\ApiBundle\Command\Account\RequestShopUserVerification.
-
GatewayConfig
- The resource is no longer exposed.
-
Translation
- All translation resources are no longer exposed.
-
ChannelPriceHistoryConfig
- The resource configuration has been removed, as it is now handled by the
Channelresource.
- The resource configuration has been removed, as it is now handled by the
-
ShopBillingData
- The resource configuration has been removed, as it is now handled by the
Channelresource.
- The resource configuration has been removed, as it is now handled by the
-
ZoneMember
- The resource configuration has been removed, as it is now handled by the
Zoneresource.
- The resource configuration has been removed, as it is now handled by the
-
ProductOptionValueTranslation
- There has been added a new resource configuration for the
ProductOptionValueTranslationresource.
- There has been added a new resource configuration for the