diff --git a/.github/workflows/matrix.json b/.github/workflows/matrix.json index fa69db7236..0745610524 100644 --- a/.github/workflows/matrix.json +++ b/.github/workflows/matrix.json @@ -50,13 +50,6 @@ "symfony": "^7.1", "mysql": "8.4", "twig": "^3.3" - }, - { - "php": "8.3", - "symfony": "^6.4", - "mysql": "8.4", - "twig": "^3.3", - "env": "test_cached_payum" } ] }, @@ -117,16 +110,7 @@ "php": ["8.2", "8.3"], "symfony": ["^6.4", "^7.1"], "mysql": ["8.0", "8.4"], - "twig": ["^3.3"], - "include": [ - { - "php": "8.3", - "symfony": "^6.4", - "mysql": "8.4", - "twig": "^3.3", - "env": "test_cached_payum" - } - ] + "twig": ["^3.3"] }, "e2e-pgsql": { "php": ["8.2", "8.3"], diff --git a/UPGRADE-2.0.md b/UPGRADE-2.0.md index 00e5319773..31179df432 100644 --- a/UPGRADE-2.0.md +++ b/UPGRADE-2.0.md @@ -1,48 +1,158 @@ # UPGRADE FROM `1.14` TO `2.0` -## Migrations +## To start off - Doctrine migrations have been regenerated, meaning all previous migration files have been removed and their content is now in a single migration file. - To apply the new migration and get rid of the old entries run migrations as usual: +Even if your app is barely customized, it will require some manual adjustments before it can run again. Depending on +whether you use Symfony Flex, some of these changes may be applied automatically, but it’s important to check them +manually regardless. + +* Packages configuration changes: + +```diff +# config/packages/_sylius.yaml + +imports: +... ++ - { resource: "@SyliusPayumBundle/Resources/config/app/config.yaml" } + +... + +sylius_payment: + resources: ++ gateway_config: ++ classes: ++ model: App\Entity\Payment\GatewayConfig + +... + +sylius_payum: + resources: +- gateway_config: +- classes: +- model: App\Entity\Payment\GatewayConfig +``` + +* API firewalls have been renamed and user checkers have been configured on them + with `security.user_checker.chain.` service: + +```diff +# config/packages/security.yaml + +security: + firewalls: + admin: + ... ++ user_checker: security.user_checker.chain.admin +- new_api_admin_user: ++ api_admin: + ... ++ user_checker: security.user_checker.chain.api_admin +- new_api_shop_user: ++ api_shop: + ... ++ user_checker: security.user_checker.chain.api_shop + shop: + ... ++ user_checker: security.user_checker.chain.shop +``` + +* Routing changes (note that these shop routes are not localized with the prefix: /{_locale} configuration entry): + +Shop: + +```diff +# config/routes/sylius_shop.yaml + +sylius_shop_payum: +- resource: "@SyliusShopBundle/Resources/config/routing/payum.yml" ++ resource: "@SyliusPayumBundle/Resources/config/routing/integrations/sylius_shop.yaml" + +sylius_payment_notify: ++ resource: "@SyliusPaymentBundle/Resources/config/routing/integrations/sylius.yaml" + +``` + +API: + +```diff +# config/routes/sylius_api.yaml + +sylius_api: + resource: "@SyliusApiBundle/Resources/config/routing.yml" +- prefix: "%sylius.security.new_api_route%" ++ prefix: "%sylius.security.api_route%" + +``` + +* Bundle configuration changes: + +```diff +# config/bundles.php + + ['all' => true], +- winzou\Bundle\StateMachineBundle\winzouStateMachineBundle::class => ['all' => true], +- Bazinga\Bundle\HateoasBundle\BazingaHateoasBundle::class => ['all' => true], +- JMS\SerializerBundle\JMSSerializerBundle::class => ['all' => true], +- FOS\RestBundle\FOSRestBundle::class => ['all' => true], +- ApiPlatform\Core\Bridge\Symfony\Bundle\ApiPlatformBundle::class => ['all' => true], +- SyliusLabs\Polyfill\Symfony\Security\Bundle\SyliusLabsPolyfillSymfonySecurityBundle::class => ['all' => true], ++ ApiPlatform\Symfony\Bundle\ApiPlatformBundle::class => ['all' => true], ++ Sylius\TwigHooks\SyliusTwigHooksBundle::class => ['all' => true], ++ Symfony\UX\TwigComponent\TwigComponentBundle::class => ['all' => true], ++ Symfony\UX\StimulusBundle\StimulusBundle::class => ['all' => true], ++ Symfony\UX\LiveComponent\LiveComponentBundle::class => ['all' => true], ++ Symfony\UX\Autocomplete\AutocompleteBundle::class => ['all' => true], +]; + +* New Symfony/Messenger transports for handling payment requests have been added. +Therefore, you need to add the following configuration to your .env file: + +```diff +###> symfony/messenger ### +... ++ SYLIUS_MESSENGER_TRANSPORT_PAYMENT_REQUEST_DSN=sync:// ++ SYLIUS_MESSENGER_TRANSPORT_PAYMENT_REQUEST_FAILED_DSN=sync:// +###< symfony/messenger ### +``` + +### Migrations + +Doctrine migrations have been regenerated, meaning all previous migration files have been removed and their content +is now in a single migration file. To apply the new migration and get rid of the old entries run migrations as usual: ```bash bin/console doctrine:migrations:migrate --no-interaction ``` -## Configuration +### PHP support -* Messenger: - * The `sylius_default.bus` and `sylius_event.bus` configuration options were removed. Use `sylius.command_bus` and - `sylius.event_bus` for commands and events respectively. +Sylius 2.0 comes with a bump of minimum supported PHP version to 8.2. -* SyliusStateMachineAbstraction: - * The `sylius_state_machine_abstraction.default_adapter` option has been changed from `winzou_state_machine` to `symfony_workflow`. +### Symfony support -* Resource: - * The configuration nodes for resource options `sylius_*.resources.**.options` (`sylius_addressing.resources.address.options` etc.) - were removed from all resource definitions in all bundles. +The support of Symfony 5.4 has been dropped. +Sylius 2.0 supports both Symfony 6.4 and 7.1 -* The `sylius_core.autoconfigure_with_attributes` and `sylius_order.autoconfigure_with_attributes` configuration parameters - have been removed. If you want to autoconfigure order processors and cart contexts, use corresponding attributes - instead of interfaces: - - * `Sylius\Bundle\OrderBundle\Attribute\AsCartContext` - * `Sylius\Bundle\OrderBundle\Attribute\AsOrderProcessor` +## Main Update -* The `sylius_user.resources.{name}.user.resetting.pin` configuration parameter has been removed. - The corresponding email `reset_password_pin` and `Sylius\Bundle\UserBundle\Controller\UserController::requestPasswordResetPinAction` - method have been removed. The related services have been removed as well: +Once you’ve applied these initial changes, your app should be able to run. However, depending on the customizations +you’ve made, you may need to make some additional adjustments. Carefully review the following changes and apply them to +your app as necessary. - * `sylius.{user_type}_user.pin_generator.password_reset` - * `sylius.{user_type}_user.pin_uniqueness_checker.password_reset` +### Dependencies -## Dependencies - -### Replaced: +#### Replaced: * The `swiftmailer/swiftmailer` dependency has been removed. Use `symfony/mailer` instead. -### Removed: +#### Moved: + +* The `sylius/theme-bundle` dependency has been moved from CoreBundle to ShopBundle. + +#### Removed: * Removed from main composer.json: @@ -111,57 +221,766 @@ * `sylius-labs/polyfill-symfony-event-dispatcher` * `sylius-labs/polyfill-symfony-framework-bundle` -### Optional +#### Optional -* Removed from required and made suggested, install them in your application, if you still want to use Winzou State Machine: +* Winzou State Machine repositories have been moved to the suggested section of composer.json, + if you still want to use them, install the following: * `winzou/state-machine` * `winzou/state-machine-bundle` -## Service Container +### Constructors signature changes -In Sylius 2.0, we have changed the visibility of services to `private` by default. This change enhances the performance and maintainability of the application and also follows Symfony's best practices for service encapsulation. +1. The following constructor signatures have been changed: + + `Sylius\Bundle\CoreBundle\Twig\CheckoutStepsExtension` + ```diff + + use Sylius\Component\Core\Checker\OrderPaymentMethodSelectionRequirementCheckerInterface; + use Sylius\Component\Core\Checker\OrderShippingMethodSelectionRequirementCheckerInterface; + + public function __construct( + - private readonly CheckoutStepsHelper|OrderPaymentMethodSelectionRequirementCheckerInterface $checkoutStepsHelper, + - private readonly ?OrderShippingMethodSelectionRequirementCheckerInterface $orderShippingMethodSelectionRequirementChecker = null, + + private readonly OrderPaymentMethodSelectionRequirementCheckerInterface $orderPaymentMethodSelectionRequirementChecker, + + private readonly OrderShippingMethodSelectionRequirementCheckerInterface $orderShippingMethodSelectionRequirementChecker, + ) + ``` + + `Sylius\Bundle\CoreBundle\Twig\PriceExtension` + ```diff + + use Sylius\Component\Core\Calculator\ProductVariantPricesCalculatorInterface; + + public function __construct( + - private readonly PriceHelper|ProductVariantPricesCalculatorInterface $helper, + + private readonly ProductVariantPricesCalculatorInterface $productVariantPricesCalculator, + ) + ``` + + `Sylius\Bundle\CoreBundle\Twig\VariantResolverExtension` + ```diff + + use Sylius\Component\Product\Resolver\ProductVariantResolverInterface; + + public function __construct( + - private readonly ProductVariantResolverInterface|VariantResolverHelper $helper, + + private readonly ProductVariantResolverInterface $productVariantResolver, + ) + ``` + + `Sylius\Bundle\CurrencyBundle\Twig\CurrencyExtension` + ```diff + + public function __construct( + - private ?CurrencyHelperInterface $helper = null, + ) + ``` + + `Sylius\Bundle\InventoryBundle\Twig\InventoryExtension` + ```diff + use Sylius\Component\Inventory\Checker\AvailabilityCheckerInterface; + + public function __construct( + - private AvailabilityCheckerInterface|InventoryHelper $helper, + + private AvailabilityCheckerInterface $availabilityChecker, + ) + ``` + + `Sylius\Bundle\LocaleBundle\Twig\LocaleExtension` + ```diff + use Sylius\Component\Locale\Context\LocaleContextInterface; + use Sylius\Component\Locale\Converter\LocaleConverterInterface; + + public function __construct( + - private LocaleConverterInterface|LocaleHelperInterface $localeHelper, + - private ?LocaleContextInterface $localeContext = null, + + private LocaleConverterInterface $localeConverter, + + private LocaleContextInterface $localeContext, + ) + ``` + + `Sylius\Bundle\MoneyBundle\Twig\ConvertMoneyExtension` + ```diff + use Sylius\Component\Currency\Converter\CurrencyConverterInterface; + + public function __construct( + - private ConvertMoneyHelperInterface|CurrencyConverterInterface $helper, + + private CurrencyConverterInterface $currencyConverter, + ) + ``` + + `Sylius\Bundle\MoneyBundle\Twig\FormatMoneyExtension` + ```diff + use Sylius\Bundle\MoneyBundle\Formatter\MoneyFormatterInterface; + + public function __construct( + - private private FormatMoneyHelperInterface|MoneyFormatterInterface $helper, + + private MoneyFormatterInterface $moneyFormatter, + ) + ``` + + `Sylius\Bundle\OrderBundle\Twig\AggregateAdjustmentsExtension` + ```diff + use Sylius\Component\Order\Aggregator\AdjustmentsAggregatorInterface; + + public function __construct( + - private AdjustmentsAggregatorInterface|AdjustmentsHelper $adjustmentsHelper, + + private AdjustmentsAggregatorInterface $adjustmentsAggregator, + ) + ``` + + `Sylius\Bundle\AdminBundle\Controller\DashboardController` + ```diff + public function __construct( + private ChannelRepositoryInterface $channelRepository, + private Environment $templatingEngine, + private RouterInterface $router, + - private ?StatisticsDataProviderInterface $statisticsDataProvider = null, + ) + ``` + + `Sylius\Bundle\AdminBundle\EventListener\AdminFilterSubscriber` + ```diff + - use Sylius\Bundle\UiBundle\Storage\FilterStorageInterface; + + use Sylius\Bundle\GridBundle\Storage\FilterStorageInterface; + + public function __construct(private FilterStorageInterface $filterStorage) + ``` + + `Sylius\Bundle\AdminBundle\Controller\RedirectHandler` + ```diff + - use Sylius\Bundle\UiBundle\Storage\FilterStorageInterface; + + use Sylius\Bundle\GridBundle\Storage\FilterStorageInterface; + + public function __construct( + private RedirectHandlerInterface $decoratedRedirectHandler, + private FilterStorageInterface $filterStorage, + ) + ``` + + `Sylius\Bundle\UiBundle\Twig\RedirectPathExtension` + ```diff + - use Sylius\Bundle\UiBundle\Storage\FilterStorageInterface; + + use Sylius\Bundle\GridBundle\Storage\FilterStorageInterface; + + public function __construct( + private FilterStorageInterface $filterStorage, + private RouterInterface $router, + ) + ``` + + `Sylius\Bundle\PayumBundle\Form\Extension\CryptedGatewayConfigTypeExtension` + ```diff + + use Sylius\Bundle\PayumBundle\Checker\PayumGatewayConfigEncryptionCheckerInterface; + + public function __construct( + + private readonly PayumGatewayConfigEncryptionCheckerInterface $encryptionChecker, + private ?CypherInterface $cypher = null, + ) + ``` + + `Sylius\Bundle\CoreBundle\Form\Type\Checkout\AddressType` + ```diff + public function __construct( + + private readonly AddressComparatorInterface $addressComparator, + string $dataClass, + array $validationGroups = [] + - private readonly AddressComparatorInterface $addressComparator = null, + ) + ``` + + `Sylius\Component\Core\OrderProcessing\OrderPaymentProcessor` + ```diff + public function __construct( + private OrderPaymentProviderInterface $orderPaymentProvider, + - private string $targetState = PaymentInterface::STATE_CART, + private OrderPaymentsRemoverInterface $orderPaymentsRemover, + private array $unprocessableOrderStates, + + private string $targetState = PaymentInterface::STATE_CART, + ) + ``` + +1. Change across the codebase: + ```diff + - private StateMachineInterface $stateMachineFactory, + + private StateMachineInterface $stateMachine, + ``` + +### Configuration Changes + +#### Messenger + +- Removed `sylius_default.bus` and `sylius_event.bus` configurations. + Use `sylius.command_bus` and `sylius.event_bus` for commands and events, respectively. + +#### Sylius State Machine Abstraction + +- Changed `sylius_state_machine_abstraction.default_adapter` from `winzou_state_machine` to `symfony_workflow`. + +#### Resource + +- Removed configuration nodes for resource options `sylius_*.resources.**.options`, such as `sylius_addressing.resources.address.options`. +- Removed `sylius_inventory.checker` configuration node. + +#### Autoconfiguration + +- Removed `sylius_core.autoconfigure_with_attributes` and `sylius_order.autoconfigure_with_attributes`. + Use the following attributes instead of interfaces for autoconfiguration: + - `Sylius\Bundle\OrderBundle\Attribute\AsCartContext` + - `Sylius\Bundle\OrderBundle\Attribute\AsOrderProcessor` + +#### User Resetting Pin + +- Removed `sylius_user.resources.{name}.user.resetting.pin` configuration parameter. + Due to that the related logic has also been removed, this includes: + - `reset_password_pin` email + - `Sylius\Bundle\UserBundle\Controller\UserController::requestPasswordResetPinAction` method + - `sylius.{user_type}_user.pin_generator.password_reset` services + - `sylius.{user_type}_user.pin_uniqueness_checker.password_reset` services + +#### Parameter Removals and Renaming + +- Removed: + - `sylius.mongodb_odm.repository.class` + - `sylius.phpcr_odm.repository.class` + - `sylius.mailer.templates` +- Renamed: + - `sylius.message.admin_user_create.validation_groups` to `sylius_admin.command_handler.create_admin_user.validation_groups` + +#### File Relocations + +- The state machine configurations of `PaymentBundle` have been moved and renamed: + +Winzou state machine: +```diff +- `@SyliusPaymentBundle/Resources/config/app/state_machine.yml` ++ `@SyliusPaymentBundle/Resources/config/app/state_machine/sylius_payment.yaml` +``` + +Symfony workflow: +```diff +- `@SyliusPaymentBundle/Resources/config/workflow/state_machine.yaml` ++ `@SyliusPaymentBundle/Resources/config/app/workflow/sylius_[resource].yaml` +``` + +#### Zone Validation Groups + +- Added a new parameter to specify validation groups for zones. + Configure custom validation groups for zone members in `config/packages/_sylius.yaml`. + Example: + + ```yaml + sylius_addressing: + zone_member: + validation_groups: + country: + - 'sylius' + - 'sylius_zone_member_country' + zone: + - 'sylius' + - 'sylius_zone_member_zone' + ``` + +#### LiipImagineBundle Default Resolver and Loader + +- Changed the default resolver and loader names for `LiipImagineBundle` from **default** to **sylius_image** ([reference](https://github.com/Sylius/Sylius/pull/12543)). + To modify these defaults, configure `cache` and/or `data_loader` parameters under the `liip_imagine` key. + +#### Grids + +The experimental `entities` filter has been removed. It has been replaced by the generic `entity` one. + +```diff +sylius_grid: + grids: + # ... + sylius_admin_catalog_promotion: + # ... + filters: + channel: +- type: entities ++ type: entity + label: sylius.ui.channel + form_options: + class: "%sylius.model.channel.class%" + options: +- field: product.channels.id ++ fields: [product.channels.id] +``` + +#### Password Encoder & Salt + +The encoder and salt have been removed from the User entities. The password hasher configured on Symfony security configuration is in use instead. + +This "encoder" is configured via +the [Symfony security password hasher](https://symfony.com/doc/current/security/passwords.html#configuring-a-password-hasher). + +For example: + +```yaml +# config/packages/security.yaml +security: + # ... + + password_hashers: + Sylius\Component\User\Model\UserInterface: argon2i +``` + +Also, check if you have an encoder configured in the `sylius_user` package configuration. + +```yaml +sylius_user: + # ... + + encoder: plaintext # Remove this line + + # ... + resources: + oauth: + user: + encoder: false # Remove this line + classes: Sylius\Component\User\Model\UserOAuth +``` + +Check your user hashed passwords in your production database. +In modern Symfony projects, the hasher name is stored along with the password. + +Example: +`$argon2i$v=19$m=65536,t=4,p=1$VVJuMnpUUWhRY1daN1ppMA$2Tx6l3I+OUx+PUPn+vZz1jI3Z6l6IHh2kpG0NdpmYWE` + +If some of your users do not have the hasher name stored in the password field you may need to configure the +"migrate_from" option by following the documentation: +https://symfony.com/doc/current/security/passwords.html#configure-a-new-hasher-using-migrate-from + +Note: +If your app never changed the hasher name configuration, you don't need to configure this "migrate_from" configuration. + +#### Routes + +* The following routes have been removed: + * `sylius_admin_dashboard_statistics` + * `sylius_admin_ajax_all_product_variants_by_codes` + * `sylius_admin_ajax_all_product_variants_by_phrase` + * `sylius_admin_ajax_customer_group_by_code` + * `sylius_admin_ajax_customer_groups_by_phrase` + * `sylius_admin_ajax_find_product_options` + * `sylius_admin_ajax_generate_product_slug` + * `sylius_admin_ajax_generate_taxon_slug` + * `sylius_admin_ajax_product_by_code` + * `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_taxon_by_code` + * `sylius_admin_ajax_taxon_by_name_phrase` + * `sylius_admin_ajax_taxon_leafs` + * `sylius_admin_ajax_taxon_root_nodes` + * `sylius_admin_dashboard_statistics` + * `sylius_admin_get_attribute_types` + * `sylius_admin_get_payment_gateways` + * `sylius_admin_get_product_attributes` + * `sylius_admin_partial_address_log_entry_index` + * `sylius_admin_partial_catalog_promotion_show` + * `sylius_admin_partial_channel_index` + * `sylius_admin_partial_customer_latest` + * `sylius_admin_partial_customer_show` + * `sylius_admin_partial_order_latest` + * `sylius_admin_partial_order_latest_in_channel` + * `sylius_admin_partial_product_show` + * `sylius_admin_partial_promotion_show` + * `sylius_admin_partial_taxon_show` + * `sylius_admin_partial_taxon_tree` + * `sylius_admin_render_attribute_forms` + * `sylius_shop_ajax_cart_add_item` + * `sylius_shop_ajax_cart_item_remove` + * `sylius_shop_ajax_user_check_action` + * `sylius_shop_partial_cart_summary` + * `sylius_shop_partial_cart_add_item` + * `sylius_shop_partial_channel_menu_taxon_index` + * `sylius_shop_partial_product_association_show` + * `sylius_shop_partial_product_index_latest` + * `sylius_shop_partial_product_review_latest` + * `sylius_shop_partial_product_show_by_slug` + * `sylius_shop_partial_taxon_index_by_code` + * `sylius_shop_partial_taxon_show_by_slug` + +### Services, classes and interfaces changes + +#### Container + +In Sylius 2.0, we have changed the visibility of services to `private` by default. This change enhances the performance +and maintainability of the application and also follows Symfony's best practices for service encapsulation. **Exceptions:** - Services required by Symfony to be `public` (e.g., controllers, event listeners) remain public. - Services used in `ResourceController` must be `public` as they are accessed directly from the container. -## Codebase +#### Classes and Interfaces -* Doctrine MongoDB and PHPCR is no longer supported in ResourceBundle and GridBundle: +1. Removed -* The following classes were removed: +* `Sylius\Bundle\ApiBundle\EventListener\PostgreSQLDriverExceptionListener` +* `Sylius\Bundle\CoreBundle\Twig\FilterExtension` +* `Sylius\Bundle\CoreBundle\DependencyInjection\Compiler\LiipImageFiltersPass` +* `Sylius\Bundle\GridBundle\Doctrine\PHPCRODM\DataSource` +* `Sylius\Bundle\GridBundle\Doctrine\PHPCRODM\Driver` +* `Sylius\Bundle\GridBundle\Doctrine\PHPCRODM\ExpressionBuilder` +* `Sylius\Bundle\GridBundle\Doctrine\PHPCRODM\ExpressionBuilderInterface` +* `Sylius\Bundle\GridBundle\Doctrine\PHPCRODM\ExpressionVisitor` +* `Sylius\Bundle\GridBundle\Doctrine\PHPCRODM\ExtraComparison` +* `Sylius\Bundle\ResourceBundle\DependencyInjection\Driver\Doctrine\DoctrineODMDriver` +* `Sylius\Bundle\ResourceBundle\DependencyInjection\Driver\Doctrine\DoctrinePHPCRDriver` +* `Sylius\Bundle\ResourceBundle\Doctrine\ODM\MongoDB\DocumentRepository` +* `Sylius\Bundle\ResourceBundle\Doctrine\ODM\MongoDB\TranslatableRepository` +* `Sylius\Bundle\ResourceBundle\Doctrine\ODM\PHPCR\DocumentRepository` +* `Sylius\Bundle\ResourceBundle\Doctrine\ODM\PHPCR\EventListener\DefaultParentListener` +* `Sylius\Bundle\ResourceBundle\Doctrine\ODM\PHPCR\EventListener\NameFilterListener` +* `Sylius\Bundle\ResourceBundle\Doctrine\ODM\PHPCR\EventListener\NameResolverListener` +* `Sylius\Bundle\ResourceBundle\Doctrine\ODM\PHPCR\Form\Builder\DefaultFormBuilder` +* `Sylius\Bundle\ResourceBundle\EventListener\ODMMappedSuperClassSubscriber` +* `Sylius\Bundle\ResourceBundle\EventListener\ODMRepositoryClassSubscriber` +* `Sylius\Bundle\ResourceBundle\EventListener\ODMTranslatableListener` +* `Sylius\Bundle\AddressingBundle\Controller\ProvinceController` +* `Sylius\Bundle\AdminBundle\Controller\NotificationController` +* `Sylius\Bundle\AdminBundle\Twig\NotificationWidgetExtension` +* `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` +* `Sylius\Bundle\ProductBundle\Controller\ProductAttributeController` +* `Sylius\Bundle\UserBundle\Security\UserLogin` +* `Sylius\Bundle\UserBundle\Security\UserLoginInterface` +* `Sylius\Bundle\UserBundle\Security\UserPasswordHasher` +* `Sylius\Bundle\UserBundle\Security\UserPasswordHasherInterface` +* `Sylius\Component\User\Security\Generator\UniquePinGenerator` +* `Sylius\Bundle\AdminBundle\Controller\Dashboard\StatisticsController` +* `Sylius\Bundle\AdminBundle\Form\Extension\CatalogPromotionActionTypeExtension` +* `Sylius\Bundle\AdminBundle\Form\Extension\CatalogPromotionScopeTypeExtension` +* `Sylius\Bundle\AdminBundle\Menu\CustomerShowMenuBuilder` +* `Sylius\Bundle\AdminBundle\Menu\OrderShowMenuBuilder` +* `Sylius\Bundle\AdminBundle\Menu\ProductFormMenuBuilder` +* `Sylius\Bundle\AdminBundle\Menu\ProductUpdateMenuBuilder` +* `Sylius\Bundle\AdminBundle\Menu\ProductVariantFormMenuBuilder` +* `Sylius\Bundle\AdminBundle\Menu\PromotionUpdateMenuBuilder` +* `Sylius\Bundle\AdminBundle\Provider\StatisticsDataProvider` +* `Sylius\Bundle\ApiBundle\ApiPlatform\Bridge\Symfony\Routing\CachedRouteNameResolver` +* `Sylius\Bundle\ApiBundle\ApiPlatform\Bridge\Symfony\Routing\RouteNameResolver` +* `Sylius\Bundle\ApiBundle\ApiPlatform\Factory\MergingExtractorResourceMetadataFactory` +* `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` +* `Sylius\Bundle\ApiBundle\Validator\ResourceApiInputDataPropertiesValidator` +* `Sylius\Bundle\ApiBundle\EventListener\PostgreSQLDriverExceptionListener` +* `Sylius\Bundle\ApiBundle\DataTransformer\CommandAwareInputDataTransformer` +* `Sylius\Bundle\ApiBundle\DataTransformer\CommandDataTransformerInterface` +* `Sylius\Bundle\CoreBundle\Console\Command\Model\PluginInfo` +* `Sylius\Bundle\CoreBundle\Form\Extension\CountryTypeExtension` +* `Sylius\Bundle\CoreBundle\Form\Extension\CustomerTypeExtension` +* `Sylius\Bundle\CoreBundle\Form\Extension\LocaleTypeExtension` +* `Sylius\Bundle\CoreBundle\Form\Type\Grid\Filter\EntitiesFilterType` +* `Sylius\Bundle\CoreBundle\Form\EventSubscriber\AddUserFormSubscriber` +* `Sylius\Bundle\CoreBundle\Twig\StateMachineExtension` +* `Sylius\Component\Core\Grid\Filter\EntitiesFilter` +* `Sylius\Component\Core\Dashboard\DashboardStatistics` +* `Sylius\Component\Core\Dashboard\DashboardStatisticsProvider` +* `Sylius\Component\Core\Dashboard\Interval` +* `Sylius\Component\Core\Dashboard\SalesDataProvider` +* `Sylius\Component\Core\Dashboard\SalesSummary` +* `Sylius\Component\Core\Dashboard\SalesSummaryInterface` +* `Sylius\Bundle\PayumBundle\Action\Paypal\ExpressCheckout\ConvertPaymentAction` +* `Sylius\Bundle\PayumBundle\Controller\PayumController` +* `Sylius\Bundle\PayumBundle\Form\Type\PaypalGatewayConfigurationType` +* `Sylius\Bundle\PayumBundle\Form\Type\StripeGatewayConfigurationType` +* `Sylius\Bundle\UiBundle\ContextProvider\DefaultContextProvider` +* `Sylius\Bundle\UiBundle\Registry\TemplateBlock` +* `Sylius\Bundle\UiBundle\Registry\TemplateBlockRegistry` +* `Sylius\Bundle\UiBundle\Renderer\DelegatingTemplateEventRenderer` +* `Sylius\Bundle\UiBundle\Renderer\TwigTemplateBlockRenderer` +* `Sylius\Bundle\UiBundle\Storage\FilterStorageInterface` +* `Sylius\Bundle\UiBundle\Twig\SortByExtension` +* `Sylius\Bundle\UiBundle\Twig\TemplateEventExtension` +* `Sylius\Bundle\UiBundle\Twig\TestFormAttributeExtension` +* `Sylius\Bundle\UiBundle\Twig\TestHtmlAttributeExtension` +* `Sylius\Bundle\PromotionBundle\Validator\CatalogPromotionAction\ActionValidatorInterface` +* `Sylius\Bundle\PromotionBundle\Validator\CatalogPromotionScope\ScopeValidatorInterface` +* `Sylius\Component\Core\Promotion\Updater\Rule\TotalOfItemsFromTaxonRuleUpdater` +* `Sylius\Bundle\AdminBundle\EmailManager\OrderEmailManager` +* `Sylius\Bundle\AdminBundle\EmailManager\ShipmentEmailManager` +* `Sylius\Bundle\ShopBundle\EmailManager\ContactEmailManager` +* `Sylius\Bundle\ShopBundle\EmailManager\OrderEmailManager` +* `Sylius\Bundle\ProductBundle\Form\Type\ProductOptionChoiceType` +* `Sylius\Component\Core\Promotion\Updater\Rule\ProductAwareRuleUpdaterInterface` +* `Sylius\Component\Promotion\Checker\Rule\CartQuantityRuleChecker` +* `Sylius\Bundle\CoreBundle\CatalogPromotion\Command\RemoveInactiveCatalogPromotion` +* `Sylius\Bundle\CoreBundle\Provider\SessionProvider` +* `Sylius\Component\Core\SyliusLocaleEvents` +* `Sylius\Bundle\ShopBundle\Twig\OrderTaxesTotalExtension` - * `Sylius\Bundle\ApiBundle\EventListener\PostgreSQLDriverExceptionListener` - * `Sylius\Bundle\CoreBundle\Twig\FilterExtension` - * `Sylius\Bundle\CoreBundle\DependencyInjection\Compiler\LiipImageFiltersPass` - * `Sylius\Bundle\GridBundle\Doctrine\PHPCRODM\DataSource` - * `Sylius\Bundle\GridBundle\Doctrine\PHPCRODM\Driver` - * `Sylius\Bundle\GridBundle\Doctrine\PHPCRODM\ExpressionBuilder` - * `Sylius\Bundle\GridBundle\Doctrine\PHPCRODM\ExpressionBuilderInterface` - * `Sylius\Bundle\GridBundle\Doctrine\PHPCRODM\ExpressionVisitor` - * `Sylius\Bundle\GridBundle\Doctrine\PHPCRODM\ExtraComparison` - * `Sylius\Bundle\ResourceBundle\DependencyInjection\Driver\Doctrine\DoctrineODMDriver` - * `Sylius\Bundle\ResourceBundle\DependencyInjection\Driver\Doctrine\DoctrinePHPCRDriver` - * `Sylius\Bundle\ResourceBundle\Doctrine\ODM\MongoDB\DocumentRepository` - * `Sylius\Bundle\ResourceBundle\Doctrine\ODM\MongoDB\TranslatableRepository` - * `Sylius\Bundle\ResourceBundle\Doctrine\ODM\PHPCR\DocumentRepository` - * `Sylius\Bundle\ResourceBundle\Doctrine\ODM\PHPCR\EventListener\DefaultParentListener` - * `Sylius\Bundle\ResourceBundle\Doctrine\ODM\PHPCR\EventListener\NameFilterListener` - * `Sylius\Bundle\ResourceBundle\Doctrine\ODM\PHPCR\EventListener\NameResolverListener` - * `Sylius\Bundle\ResourceBundle\Doctrine\ODM\PHPCR\Form\Builder\DefaultFormBuilder` - * `Sylius\Bundle\ResourceBundle\EventListener\ODMMappedSuperClassSubscriber` - * `Sylius\Bundle\ResourceBundle\EventListener\ODMRepositoryClassSubscriber` - * `Sylius\Bundle\ResourceBundle\EventListener\ODMTranslatableListener` +1. Renamed -* The following services were removed: +| Old Name | New Name | +|----------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------| +| `Sylius\Bundle\ApiBundle\CommandHandler\Account\ResendVerificationEmailHandler` | `Sylius\Bundle\ApiBundle\CommandHandler\Account\RequestShopUserVerificationHandler` | +| `Sylius\Bundle\ApiBundle\CommandHandler\Account\SendAccountVerificationEmailHandler` | `Sylius\Bundle\ApiBundle\CommandHandler\Account\SendShopUserVerificationEmailHandler` | +| `Sylius\Bundle\ApiBundle\CommandHandler\Account\VerifyCustomerAccountHandler` | `Sylius\Bundle\ApiBundle\CommandHandler\Account\VerifyShopUserHandler` | - * `sylius.event_subscriber.odm_mapped_super_class` - * `sylius.event_subscriber.odm_repository_class` - * `sylius.grid_driver.doctrine.phpcrodm` - * `sylius.listener.api_postgresql_driver_exception_listener` +1. Moved -* Aliases introduced in Sylius 1.14 have now become the primary service IDs in Sylius 2.0. The old service IDs have been removed, and all references must be updated accordingly: +| From | To | +|------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------| +| `Sylius\Bundle\PayumBundle\Validator\GatewayFactoryExistsValidator` | `Sylius\Bundle\PaymentBundle\Validator\Constraints\GatewayFactoryExistsValidator` | +| `Sylius\Bundle\PayumBundle\Validator\GroupsGenerator\GatewayConfigGroupsGenerator` | `Sylius\Bundle\PaymentBundle\Validator\Constraints\GatewayConfigGroupsGenerator` | +| `Sylius\Component\Promotion\Checker\Rule\ItemTotalRuleChecker` | `Sylius\Component\Core\Promotion\Checker\Rule\ItemTotalRuleChecker` | + +#### Services and Aliases + +1. Removed + +* `sylius.event_subscriber.odm_mapped_super_class` +* `sylius.event_subscriber.odm_repository_class` +* `sylius.grid_driver.doctrine.phpcrodm` +* `sylius.listener.api_postgresql_driver_exception_listener` +* `sylius.security.password_hasher` +* `sylius.security.user_login` +* `Sylius\Bundle\UserBundle\Security\UserLoginInterface` +* `Sylius\Component\User\Security\UserPasswordHasherInterface` +* `sylius.controller.admin.notification` +* `Sylius\Buxndle\AdminBundle\Form\Extension\CatalogPromotionActionTypeExtension` +* `sylius.controller.admin.dashboard.statistics` +* `Sylius\Bundle\AdminBundle\Form\Extension\CatalogPromotionScopeTypeExtension` +* `sylius.admin.menu_builder.customer.show` +* `sylius.admin.menu_builder.order.show` +* `sylius.admin.menu_builder.product_form` +* `sylius.admin.menu_builder.product_variant_form` +* `sylius.admin.menu_builder.promotion.update` +* `Sylius\Bundle\AdminBundle\Provider\StatisticsDataProviderInterface` +* `Sylius\Bundle\ApiBundle\ApiPlatform\ApiResourceConfigurationMerger` +* `api_platform.route_name_resolver.cached` +* `api_platform.route_name_resolver` +* `api_platform.metadata.resource.metadata_factory.yaml` +* `Sylius\Bundle\ApiBundle\ApiPlatform\Metadata\Merger\LegacyResourceMetadataMerger` +* `Sylius\Bundle\ApiBundle\ApiPlatform\ResourceMetadataPropertyValueResolver` +* `Sylius\Bundle\ApiBundle\Controller\GetAddressLogEntryCollectionAction` +* `Sylius\Bundle\ApiBundle\Controller\GetOrderAdjustmentsAction` +* `Sylius\Bundle\ApiBundle\Controller\UploadAvatarImageAction` +* `Sylius\Bundle\ApiBundle\Controller\UploadProductImageAction` +* `Sylius\Bundle\ApiBundle\Controller\UploadTaxonImageAction` +* `Sylius\Bundle\ApiBundle\DataPersister\AddressDataPersister` +* `Sylius\Bundle\ApiBundle\DataPersister\AdminUserDataPersister` +* `Sylius\Bundle\ApiBundle\DataPersister\ChannelDataPersister` +* `Sylius\Bundle\ApiBundle\DataPersister\CountryDataPersister` +* `Sylius\Bundle\ApiBundle\DataPersister\CustomerDataPersister` +* `Sylius\Bundle\ApiBundle\DataPersister\LocaleDataPersister` +* `Sylius\Bundle\ApiBundle\DataPersister\MessengerDataPersister` +* `Sylius\Bundle\ApiBundle\DataPersister\PaymentMethodDataPersister` +* `Sylius\Bundle\ApiBundle\DataPersister\ProductAttributeDataPersister` +* `Sylius\Bundle\ApiBundle\DataPersister\ProductDataPersister` +* `Sylius\Bundle\ApiBundle\DataPersister\ProductTaxonDataPersister` +* `Sylius\Bundle\ApiBundle\DataPersister\ProductVariantDataPersister` +* `Sylius\Bundle\ApiBundle\DataPersister\PromotionCouponDataPersister` +* `Sylius\Bundle\ApiBundle\DataPersister\PromotionDataPersister` +* `Sylius\Bundle\ApiBundle\DataPersister\ShippingMethodDataPersister` +* `Sylius\Bundle\ApiBundle\DataPersister\TranslatableDataPersister` +* `Sylius\Bundle\ApiBundle\DataPersister\ZoneDataPersister` +* `Sylius\Bundle\ApiBundle\DataProvider\AccountResetPasswordItemDataProvider` +* `Sylius\Bundle\ApiBundle\DataProvider\AdminOrderItemAdjustmentsSubresourceDataProvider` +* `Sylius\Bundle\ApiBundle\DataProvider\AdminResetPasswordItemDataProvider` +* `Sylius\Bundle\ApiBundle\DataProvider\ChannelAwareItemDataProvider` +* `Sylius\Bundle\ApiBundle\DataProvider\ChannelsCollectionDataProvider` +* `Sylius\Bundle\ApiBundle\DataProvider\CustomerItemDataProvider` +* `Sylius\Bundle\ApiBundle\DataProvider\OrderAdjustmentsSubresourceDataProvider` +* `Sylius\Bundle\ApiBundle\DataProvider\OrderItemAdjustmentsSubresourceDataProvider` +* `Sylius\Bundle\ApiBundle\DataProvider\OrderItemItemDataProvider` +* `Sylius\Bundle\ApiBundle\DataProvider\OrderItemUnitItemDataProvider` +* `Sylius\Bundle\ApiBundle\DataProvider\PaymentItemDataProvider` +* `Sylius\Bundle\ApiBundle\DataProvider\PaymentMethodsCollectionDataProvider` +* `Sylius\Bundle\ApiBundle\DataProvider\ProductAttributesSubresourceDataProvider` +* `Sylius\Bundle\ApiBundle\DataProvider\ProductItemDataProvider` +* `Sylius\Bundle\ApiBundle\DataProvider\ShipmentItemDataProvider` +* `Sylius\Bundle\ApiBundle\DataProvider\ShippingMethodsCollectionDataProvider` +* `Sylius\Bundle\ApiBundle\DataProvider\VerifyCustomerAccountItemDataProvider` +* `Sylius\Bundle\ApiBundle\Filter\Doctrine\PromotionCouponPromotionFilter` +* `Sylius\Bundle\ApiBundle\Filter\PaymentMethodFilter` +* `Sylius\Bundle\ApiBundle\Filter\ShippingMethodFilter` +* `Sylius\Bundle\ApiBundle\QueryHandler\GetAddressLogEntryCollectionHandler` +* `Sylius\Bundle\ApiBundle\Serializer\FlattenExceptionNormalizer` +* `Sylius\Bundle\ApiBundle\SerializerContextBuilder\ReadOperationContextBuilder` +* `Sylius\Bundle\ApiBundle\Validator\Constraints\AccountVerificationTokenEligibilityValidator` +* `Sylius\Bundle\ApiBundle\Validator\ResourceInputDataPropertiesValidatorInterface` +* `Sylius\Bundle\ApiBundle\DataTransformer\ChannelCodeAwareInputCommandDataTransformer` +* `sylius.api.data_transformer.command_aware_input_data_transformer` +* `Sylius\Bundle\ApiBundle\DataTransformer\LocaleCodeAwareInputCommandDataTransformer` +* `Sylius\Bundle\ApiBundle\DataTransformer\LoggedInCustomerEmailAwareCommandDataTransformer` +* `Sylius\Bundle\ApiBundle\DataTransformer\LoggedInCustomerEmailIfNotSetAwareCommandDataTransformer` +* `Sylius\Bundle\ApiBundle\DataTransformer\LoggedInShopUserIdAwareCommandDataTransformer` +* `Sylius\Bundle\ApiBundle\DataTransformer\OrderTokenValueAwareInputCommandDataTransformer` +* `Sylius\Bundle\ApiBundle\DataTransformer\ShipmentIdAwareInputCommandDataTransformer` +* `Sylius\Bundle\ApiBundle\DataTransformer\SubresourceIdAwareCommandDataTransformer` +* `api_platform.action.post_item` +* `Sylius\Bundle\CoreBundle\Console\Command\ShowAvailablePluginsCommand` +* `sylius.form.extension.type.country` +* `sylius.form.extension.type.customer` +* `sylius.form.extension.type.locale` +* `sylius.grid_filter.entities` +* `sylius.dashboard.statistics_provider` +* `Sylius\Component\Core\Dashboard\SalesDataProviderInterface` +* `sylius.payum_action.paypal_express_checkout.convert_payment` +* `sylius.controller.payum` +* `sylius.form.type.gateway_configuration.stripe` +* `Sylius\Bundle\UiBundle\Console\Command\DebugTemplateEventCommand` +* `Sylius\Bundle\UiBundle\ContextProvider\ContextProviderInterface` +* `Sylius\Bundle\UiBundle\DataCollector\TemplateBlockDataCollector` +* `Sylius\Bundle\UiBundle\DataCollector\TemplateBlockRenderingHistory` +* `Sylius\Bundle\UiBundle\DataCollector\TraceableTemplateBlockRenderer` +* `Sylius\Bundle\UiBundle\DataCollector\TraceableTemplateEventRenderer` +* `Sylius\Bundle\UiBundle\Registry\TemplateBlockRegistryInterface` +* `Sylius\Bundle\UiBundle\Renderer\HtmlDebugTemplateBlockRenderer` +* `Sylius\Bundle\UiBundle\Renderer\HtmlDebugTemplateEventRenderer` +* `Sylius\Bundle\UiBundle\Renderer\TemplateBlockRendererInterface` +* `Sylius\Bundle\UiBundle\Renderer\TemplateEventRendererInterface` +* `Sylius\Bundle\UiBundle\Storage\FilterStorage` +* `Sylius\Bundle\UiBundle\Twig\LegacySonataBlockExtension` +* `sylius.twig.extension.template_event` +* `Sylius\Bundle\PromotionBundle\Validator\CatalogPromotionActionValidator` +* `Sylius\Bundle\PromotionBundle\Validator\CatalogPromotionScopeValidator` +* `Sylius\Component\Promotion\Generator\PromotionCouponGeneratorInstructionInterface` +* `sylius.promotion_rule_updater.total_of_items_from_taxon` +* `Sylius\Component\Core\Promotion\Updater\Rule\ContainsProductRuleUpdater` +* `Sylius\Bundle\AdminBundle\EmailManager\OrderEmailManagerInterface` +* `sylius.email_manager.shipment` +* `Sylius\Bundle\AdminBundle\EmailManager\ShipmentEmailManagerInterface` +* `Sylius\Bundle\ShopBundle\EmailManager\ContactEmailManagerInterface` +* `sylius.email_manager.contact` +* `sylius.email_manager.order` +* `Sylius\Bundle\ShopBundle\EmailManager\OrderEmailManagerInterface` +* `sylius.form.type.product_option_choice` +* `Sylius\Bundle\ShopBundle\Calculator\OrderItemsSubtotalCalculatorInterface` +* `sylius.calculator.order_items_subtotal` +* `Sylius\Bundle\CoreBundle\CatalogPromotion\CommandHandler\RemoveInactiveCatalogPromotionHandler` +* `sylius.http_message_factory` +* `sylius.twig.extension.taxes` + +1. Renamed + +| Old Name | New Name | +|------------------------------------------------------------------------------------|--------------------------------------------------------------------------| +| `sylius.twig.extension.form_test_attribute_array` | `sylius_twig_extra.twig.extension.test_form_attribute` | +| `sylius.twig.extension.form_test_attribute_name` | `sylius_twig_extra.twig.extension.test_html_attribute` | +| `sylius.twig.extension.sort_by` | `sylius_twig_extra.twig.extension.sort_by` | +| `Sylius\Bundle\UiBundle\Twig\RouteExistsExtension` | `sylius_twig_extra.twig.extension.route_exists` | +| `sylius.form_registry.payum_gateway_config` | `sylius.form_registry.payment_gateway_config` (moved to `PaymentBundle`) | +| `Sylius\Bundle\PayumBundle\Validator\GatewayFactoryExistsValidator` | `sylius.validator.gateway_factory_exists` | +| `Sylius\Bundle\PayumBundle\Validator\GroupsGenerator\GatewayConfigGroupsGenerator` | `sylius.validator.groups_generator.gateway_config` | + +1. Replaced + +| Old Name | New Name | +|--------------------------------------------------------------------|------------------------------------------------------------------| +| `Sylius\Bundle\AdminBundle\EventListener\ResourceDeleteSubscriber` | `Sylius\Bundle\AdminBundle\EventListener\ResourceDeleteListener` | + +1. Definition location changed + + * The `Sylius\Bundle\PromotionBundle\Form\Type\CatalogPromotionAction\PercentageDiscountActionConfigurationType` + was moved to the `CoreBundle` from `PromotionBundle`. + * The `Sylius\Bundle\PromotionBundle\Form\Type\CatalogPromotionScopeType` was moved from the `CoreBundle` + to the `PromotionBundle`. + +#### Class changes + +1. Added `Sylius\Component\Order\Context\ResettableCartContextInterface`, which extends `Sylius\Component\Order\Context\CartContextInterface` + and `Symfony\Contracts\Service\ResetInterface`. + +1. Replaced `sylius/calendar` with `symfony/clock`. All instances of `Sylius\Calendar\Provider\DateTimeProviderInterface` + are now replaced by `Symfony\Component\Clock\ClockInterface`. + + Affected classes: + - `Sylius\Bundle\CoreBundle\CatalogPromotion\Announcer\CatalogPromotionAnnouncer` + - `Sylius\Bundle\CoreBundle\MessageHandler\Admin\Account\RequestResetPasswordEmailHandler` + - `Sylius\Bundle\CoreBundle\PriceHistory\Logger\PriceChangeLogger` + - `Sylius\Bundle\CoreBundle\PriceHistory\Remover\ChannelPricingLogEntriesRemover` + - `Sylius\Bundle\ShippingBundle\Assigner\ShippingDateAssigner` + - `Sylius\Bundle\PromotionBundle\Criteria\DateRange` + - `Sylius\Bundle\ApiBundle\Applicator\ArchivingShippingMethodApplicator` + - `Sylius\Bundle\ApiBundle\CommandHandler\Account\RequestResetPasswordTokenHandler` + - `Sylius\Bundle\ApiBundle\CommandHandler\Account\VerifyCustomerAccountHandler` + - `Sylius\Component\Taxation\Checker\TaxRateDateEligibilityChecker` + +1. The `\Serializable` interface has been removed from `Sylius\Component\User\Model\UserInterface`. + +#### New and Updated Repository Classes + +##### New Repositories +- **Addressing**: + - `Sylius\Bundle\AddressingBundle\Doctrine\ORM\AddressRepository` + - `Sylius\Bundle\AddressingBundle\Doctrine\ORM\CountryRepository` + - `Sylius\Bundle\AddressingBundle\Doctrine\ORM\ProvinceRepository` + - `Sylius\Bundle\AddressingBundle\Doctrine\ORM\ZoneMemberRepository` + +- **Attribute**: + - `Sylius\Bundle\AttributeBundle\Doctrine\ORM\AttributeRepository` + - `Sylius\Bundle\AttributeBundle\Doctrine\ORM\AttributeTranslationRepository` + - `Sylius\Bundle\AttributeBundle\Doctrine\ORM\AttributeValueRepository` + +- **Product**: + - `Sylius\Bundle\ProductBundle\Doctrine\ORM\ProductAssociationRepository` + - `Sylius\Bundle\ProductBundle\Doctrine\ORM\ProductAssociationTypeTranslationRepository` + - `Sylius\Bundle\ProductBundle\Doctrine\ORM\ProductAttributeRepository` + - `Sylius\Bundle\ProductBundle\Doctrine\ORM\ProductAttributeTranslationRepository` + - `Sylius\Bundle\ProductBundle\Doctrine\ORM\ProductOptionTranslationRepository` + - `Sylius\Bundle\ProductBundle\Doctrine\ORM\ProductOptionValueRepository` + - `Sylius\Bundle\ProductBundle\Doctrine\ORM\ProductOptionValueTranslationRepository` + - `Sylius\Bundle\ProductBundle\Doctrine\ORM\ProductTranslationRepository` + - `Sylius\Bundle\ProductBundle\Doctrine\ORM\ProductVariantTranslationRepository` + +- **Currency**: + - `Sylius\Bundle\CurrencyBundle\Doctrine\ORM\CurrencyRepository` + +##### Repository Inheritance Changes + +- **Addressing**: + - `Sylius\Bundle\CoreBundle\Doctrine\ORM\AddressRepository` now extends `Sylius\Bundle\AddressingBundle\Doctrine\ORM\AddressRepository`. + - `Sylius\Component\Core\Repository\AddressRepositoryInterface` now implements `Sylius\Component\Addressing\Repository\AddressRepositoryInterface`. + +- **Attribute**: + - `Sylius\Bundle\CoreBundle\Doctrine\ORM\AttributeRepository` now extends `Sylius\Bundle\AttributeBundle\Doctrine\ORM\AttributeRepository`. + - `Sylius\Component\Product\Repository\ProductAttributeValueRepositoryInterface` now implements `Sylius\Component\Attribute\Repository\AttributeValueRepositoryInterface`. + +- **Product**: + - `Sylius\Bundle\CoreBundle\Doctrine\ORM\ProductAssociationRepository` now extends `Sylius\Bundle\ProductBundle\Doctrine\ORM\ProductAssociationRepository`. + +#### User Model Updates + +- Removed fields and corresponding methods for: + - `locked` + - `expiresAt` + - `credentialsExpireAt` +- These changes affect the ShopUser and AdminUser models, and any custom user type extending the `Sylius\Component\User\Model\User` model, + as well as the relevant columns in the database tables. + +#### Service Aliases + +* Aliases introduced in Sylius 1.14 have now become the primary service IDs in Sylius 2.0. The old service IDs have been + removed, and all references must be updated accordingly: | Old ID | New ID | |---------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------| @@ -662,9 +1481,11 @@ In Sylius 2.0, we have changed the visibility of services to `private` by defaul | `Sylius\Bundle\UserBundle\Console\Command\PromoteUserCommand` | `sylius.console.command.promote_user` | | `sylius.listener.user_mailer_listener` | `sylius.listener.user_mailer` | - The old service IDs are no longer available in Sylius 2.0. Please ensure your configurations and service references use the new service IDs. +The old service IDs are no longer available in Sylius 2.0. Please ensure your configurations and service references use +the new service IDs. -* The following services had new aliases added in Sylius 1.14. In Sylius 2.0, these aliases have become the primary service IDs, and the old service IDs remain as aliases: +* The following services had new aliases added in Sylius 1.14. In Sylius 2.0, these aliases have become the primary + service IDs, and the old service IDs remain as aliases: | Current ID | New Alias | |--------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------| @@ -731,22 +1552,7 @@ In Sylius 2.0, we have changed the visibility of services to `private` by defaul | **TaxonomyBundle** | | | `Sylius\Bundle\TaxonomyBundle\Repository\TaxonTreeRepositoryInterface` | `sylius.custom_repository.tree.taxon` | -* Aliases for the `knp_menu.menu_builder` tags introduced in Sylius 1.14 are now the only valid menu builder tags in Sylius 2.0: - -| Old Alias | New Alias | -|-----------------------|-----------------------| -| **AdminBundle** | | -| `sylius.admin.main` | `sylius_admin.main` | -| **ShopBundle** | | -| `sylius.shop.account` | `sylius_shop.account` | - -* The following classes have been renamed: - -| Old Name | New Name | -|----------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------| -| `Sylius\Bundle\ApiBundle\CommandHandler\Account\ResendVerificationEmailHandler` | `Sylius\Bundle\ApiBundle\CommandHandler\Account\RequestShopUserVerificationHandler` | -| `Sylius\Bundle\ApiBundle\CommandHandler\Account\SendAccountVerificationEmailHandler` | `Sylius\Bundle\ApiBundle\CommandHandler\Account\SendShopUserVerificationEmailHandler` | -| `Sylius\Bundle\ApiBundle\CommandHandler\Account\VerifyCustomerAccountHandler` | `Sylius\Bundle\ApiBundle\CommandHandler\Account\VerifyShopUserHandler` | +### Architecture changes * The `Normalizer` and `Denormalizer` in `ApiBundle` have been reorganized into subdirectories, moving from `Sylius\Bundle\ApiBundle\Serializer` to `Sylius\Bundle\ApiBundle\Serializer\Normalizer` and `Sylius\Bundle\ApiBundle\Serializer\Denormalizer`. @@ -756,732 +1562,69 @@ In Sylius 2.0, we have changed the visibility of services to `private` by defaul * The `Filter`, `QueryCollectionExtension`, and `QueryItemExtension` classes in `ApiBundle` have been reorganized into separate sections (`admin`, `shop`, `common`) based on their usage context, and grouped by resources. -* The definition of the service `Sylius\Bundle\PromotionBundle\Form\Type\CatalogPromotionAction\PercentageDiscountActionConfigurationType` was moved to the `CoreBundle`. +* `AdminBundle` now contains base form types for every resource. +Use these as an extension point for admin customizations instead the ones from `CoreBundle` or other minor bundles. +Similarly, use form types from `ShopBundle` for the Shop context. -* The definition of the service `Sylius\Bundle\PromotionBundle\Form\Type\CatalogPromotionScopeType` was moved to the `PromotionBundle`. +### Payment method gateways -* The following parameters were removed: +* Stripe and Paypal Express Checkout gateways have been removed. + The only remaining by default gateway in core is `offline`. Use sylius plugins for the gateways of your choosing. - * `sylius.mongodb_odm.repository.class` - * `sylius.phpcr_odm.repository.class` - -* The following parameters were renamed: +### Theming - * `sylius.message.admin_user_create.validation_groups` to `sylius_admin.command_handler.create_admin_user.validation_groups` +* Channel's `themeName` form field existence is made optional and depends on `ShopBundle` presence. +* The `Sylius\Bundle\CoreBundle\Theme\ChannelBasedThemeContext` has been moved to + the `Sylius\Bundle\ShopBundle\Theme\ChannelBasedThemeContext`. -* The following configuration options were removed: +### Frontend - * `sylius.mailer.templates` - -* Added the `Sylius\Component\Order\Context\ResettableCartContextInterface` that - extends `Sylius\Component\Order\Context\CartContextInterface` and `Symfony\Contracts\Service\ResetInterface`. - -* The name of the default `LiipImagineBundle`'s resolver and loader were changed from **default** to **sylius_image - ** ([reference](https://github.com/Sylius/Sylius/pull/12543)). - To change the default resolver and/or loader for `LiipImagineBundle`, configure `cache` and/or `data_loader` - parameters under the `liip_imagine` key. - -* The class `Sylius\Bundle\AdminBundle\EventListener\ResourceDeleteSubscriber` has been removed and replaced with - `Sylius\Bundle\AdminBundle\EventListener\ResourceDeleteListener`. - -* The `sylius/calendar` package has been replaced with `symfony/clock` package. All usages of - the `Sylius\Calendar\Provider\DateTimeProviderInterface` class - have been replaced with `Symfony\Component\Clock\ClockInterface` class. - - * The following classes were changed: - - * `Sylius\Bundle\CoreBundle\CatalogPromotion\Announcer\CatalogPromotionAnnouncer` - * `Sylius\Bundle\CoreBundle\MessageHandler\Admin\Account\RequestResetPasswordEmailHandler` - * `Sylius\Bundle\CoreBundle\PriceHistory\Logger\PriceChangeLogger` - * `Sylius\Bundle\CoreBundle\PriceHistory\Remover\ChannelPricingLogEntriesRemover` - * `Sylius\Bundle\ShippingBundle\Assigner\ShippingDateAssigner` - * `Sylius\Bundle\PromotionBundle\Criteria\DateRange` - * `Sylius\Bundle\ApiBundle\Applicator\ArchivingShippingMethodApplicator` - * `Sylius\Bundle\ApiBundle\CommandHandler\Account\RequestResetPasswordTokenHandler` - * `Sylius\Bundle\ApiBundle\CommandHandler\Account\VerifyCustomerAccountHandler` - * `Sylius\Component\Taxation\Checker\TaxRateDateEligibilityChecker` - -* The parameter order of `Sylius\Bundle\CoreBundle\Form\Type\Checkout\AddressType::__construct` has been changed: - - ```php - public function __construct( - + private readonly AddressComparatorInterface $addressComparator, - string $dataClass, - array $validationGroups = [] - - private readonly AddressComparatorInterface $addressComparator = null, - ) - ``` - -* The `\Serializable` interface has been removed from the `Sylius\Component\User\Model\UserInterface`. - -* The parameter order of the `Sylius\Component\Core\OrderProcessing\OrderPaymentProcessor::__construct` has been - changed: - - ```php - public function __construct( - private OrderPaymentProviderInterface $orderPaymentProvider, - - private string $targetState = PaymentInterface::STATE_CART, - private OrderPaymentsRemoverInterface $orderPaymentsRemover, - private array $unprocessableOrderStates, - + private string $targetState = PaymentInterface::STATE_CART, - ) - ``` - -* The following repository classes and interfaces were added, if you have custom repositories, - you need to update them to extend the new ones: - - Addressing: - - * `Sylius\Bundle\AddressingBundle\Doctrine\ORM\AddressRepository` - extends `Sylius\Bundle\ResourceBundle\Doctrine\ORM\EntityRepository` - implements `Sylius\Component\Addressing\Repository\AddressRepositoryInterface` - * `Sylius\Bundle\AddressingBundle\Doctrine\ORM\CountryRepository` - extends `Sylius\Bundle\ResourceBundle\Doctrine\ORM\EntityRepository` - implements `Sylius\Component\Addressing\Repository\CountryRepositoryInterface` - * `Sylius\Bundle\AddressingBundle\Doctrine\ORM\ProvinceRepository` - extends `Sylius\Bundle\ResourceBundle\Doctrine\ORM\EntityRepository` - implements `Sylius\Component\Addressing\Repository\ProvinceRepositoryInterface` - * `Sylius\Bundle\AddressingBundle\Doctrine\ORM\ZoneMemberRepository` - extends `Sylius\Bundle\ResourceBundle\Doctrine\ORM\EntityRepository` - implements `Sylius\Component\Addressing\Repository\ZoneMemberRepositoryInterface` - - Attribute: - - * `Sylius\Bundle\AttributeBundle\Doctrine\ORM\AttributeRepository` - extends `Sylius\Bundle\ResourceBundle\Doctrine\ORM\EntityRepository` - implements `Sylius\Component\Attribute\Repository\AttributeRepositoryInterface` - * `Sylius\Bundle\AttributeBundle\Doctrine\ORM\AttributeTranslationRepository` - extends `Sylius\Bundle\ResourceBundle\Doctrine\ORM\EntityRepository` - implements `Sylius\Component\Attribute\Repository\AttributeTranslationRepositoryInterface` - * `Sylius\Bundle\AttributeBundle\Doctrine\ORM\AttributeValueRepository` - extends `Sylius\Bundle\ResourceBundle\Doctrine\ORM\EntityRepository` - implements `Sylius\Component\Attribute\Repository\AttributeValueRepositoryInterface` - - Product: - - * `Sylius\Bundle\ProductBundle\Doctrine\ORM\ProductAssociationRepository` - * `Sylius\Bundle\ProductBundle\Doctrine\ORM\ProductAssociationTypeTranslationRepository` - * `Sylius\Bundle\ProductBundle\Doctrine\ORM\ProductAttributeRepository` - * `Sylius\Bundle\ProductBundle\Doctrine\ORM\ProductAttributeTranslationRepository` - * `Sylius\Bundle\ProductBundle\Doctrine\ORM\ProductOptionTranslationRepository` - * `Sylius\Bundle\ProductBundle\Doctrine\ORM\ProductOptionValueRepository` - * `Sylius\Bundle\ProductBundle\Doctrine\ORM\ProductOptionValueTranslationRepository` - * `Sylius\Bundle\ProductBundle\Doctrine\ORM\ProductTranslationRepository` - * `Sylius\Bundle\ProductBundle\Doctrine\ORM\ProductVariantTranslationRepository` - - Currency: - - * `Sylius\Bundle\CurrencyBundle\Doctrine\ORM\CurrencyRepository` - extends `Sylius\Bundle\ResourceBundle\Doctrine\ORM\EntityRepository` - implements `Sylius\Component\Currency\Repository\CurrencyRepositoryInterface` - -* The following repository classes and interfaces namespaces were changed, if you have custom repositories, - you need to update them to extend the new ones: - - Addressing: - - * `Sylius\Bundle\CoreBundle\Doctrine\ORM\AddressRepository` extended class changed from - `Sylius\Bundle\ResourceBundle\Doctrine\ORM\EntityRepository` to - `Sylius\Bundle\AddressingBundle\Doctrine\ORM\AddressRepository` - * `Sylius\Component\Core\Repository\AddressRepositoryInterface` implemented interface changed from - `Sylius\Component\Resource\Repository\RepositoryInterface` to - `Sylius\Component\Addressing\Repository\AddressRepositoryInterface` - - Attribute: - - * `Sylius\Bundle\CoreBundle\Doctrine\ORM\AttributeRepository` extended class changed from - `Sylius\Bundle\ResourceBundle\Doctrine\ORM\EntityRepository` to - `Sylius\Bundle\AttributeBundle\Doctrine\ORM\AttributeRepository` - * `Sylius\Component\Product\Repository\ProductAttributeValueRepositoryInterface` extended interface changed from - `Sylius\Component\Resource\Repository\RepositoryInterface` to - `Sylius\Component\Attribute\Repository\AttributeValueRepositoryInterface` - - Product: - - * `Sylius\Bundle\CoreBundle\Doctrine\ORM\ProductAssociationRepository` extended class changed from - `Sylius\Bundle\ResourceBundle\Doctrine\ORM\EntityRepository` to - `Sylius\Bundle\ProductBundle\Doctrine\ORM\ProductAssociationRepository` - -* A new parameter has been added to specify the validation groups for a given zone. - If you have any custom validation groups for zone member, you need to add them to - your `config/packages/_sylius.yaml` file. - This is handled by `Sylius\Bundle\AddressingBundle\Validator\Constraints\ZoneMemberGroup` and it resolves the groups - based on the type of the passed zone. - -* The following constructor parameter has been changed across the codebase: - - ```php - - private StateMachineInterface $stateMachineFactory, - + private StateMachineInterface $stateMachine, - ``` - - ```yaml - sylius_addressing: - zone_member: - validation_groups: - country: - - 'sylius' - - 'sylius_zone_member_country' - zone: - - 'sylius' - - 'sylius_zone_member_zone' - ``` - -* The `locked`, `expiresAt` and `credentialsExpireAt` fields have been removed from the User model, both ShopUser and AdminUser, - as well as the corresponding methods in the User model and columns in the database tables. - -* The following classes and interfaces have been removed: - - * `Sylius\Bundle\AddressingBundle\Controller\ProvinceController` - * `Sylius\Bundle\AdminBundle\Controller\NotificationController` - * `Sylius\Bundle\AdminBundle\Twig\NotificationWidgetExtension` - * `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` - * `Sylius\Bundle\ProductBundle\Controller\ProductAttributeController` - * `Sylius\Bundle\UserBundle\Security\UserLogin` - * `Sylius\Bundle\UserBundle\Security\UserLoginInterface` - * `Sylius\Bundle\UserBundle\Security\UserPasswordHasher` - * `Sylius\Bundle\UserBundle\Security\UserPasswordHasherInterface` - * `Sylius\Component\User\Security\Generator\UniquePinGenerator` - -* The following services and aliases have been removed: - - * `sylius.security.password_hasher` - * `sylius.security.user_login` - * `Sylius\Bundle\UserBundle\Security\UserLoginInterface` - * `Sylius\Component\User\Security\UserPasswordHasherInterface` - * `sylius.controller.admin.notification` - -* The service `sylius.form_registry.payum_gateway_config` has been moved to the `PaymentBundle`, and its ID changed to `sylius.form_registry.payment_gateway_config`. - -* The class `Sylius\Bundle\PayumBundle\Validator\GatewayFactoryExistsValidator` has been moved to the `PaymentBundle`, and its service ID changed to`sylius.validator.gateway_factory_exists`. - -* The class `Sylius\Bundle\PayumBundle\Validator\GroupsGenerator\GatewayConfigGroupsGenerator` has been moved to the `PaymentBundle`, and its service ID changed to`sylius.validator.groups_generator.gateway_config`. - -### Constructors signature changes - -1. The following constructor signatures have been changed: - - `Sylius\Bundle\CoreBundle\Twig\CheckoutStepsExtension` - ```diff - - use Sylius\Component\Core\Checker\OrderPaymentMethodSelectionRequirementCheckerInterface; - use Sylius\Component\Core\Checker\OrderShippingMethodSelectionRequirementCheckerInterface; - - public function __construct( - - private readonly CheckoutStepsHelper|OrderPaymentMethodSelectionRequirementCheckerInterface $checkoutStepsHelper, - - private readonly ?OrderShippingMethodSelectionRequirementCheckerInterface $orderShippingMethodSelectionRequirementChecker = null, - + private readonly OrderPaymentMethodSelectionRequirementCheckerInterface $orderPaymentMethodSelectionRequirementChecker, - + private readonly OrderShippingMethodSelectionRequirementCheckerInterface $orderShippingMethodSelectionRequirementChecker, - ) - ``` - - `Sylius\Bundle\CoreBundle\Twig\PriceExtension` - ```diff - - use Sylius\Component\Core\Calculator\ProductVariantPricesCalculatorInterface; - - public function __construct( - - private readonly PriceHelper|ProductVariantPricesCalculatorInterface $helper, - + private readonly ProductVariantPricesCalculatorInterface $productVariantPricesCalculator, - ) - ``` - - `Sylius\Bundle\CoreBundle\Twig\VariantResolverExtension` - ```diff - - use Sylius\Component\Product\Resolver\ProductVariantResolverInterface; - - public function __construct( - - private readonly ProductVariantResolverInterface|VariantResolverHelper $helper, - + private readonly ProductVariantResolverInterface $productVariantResolver, - ) - ``` - - `Sylius\Bundle\CurrencyBundle\Twig\CurrencyExtension` - ```diff - - public function __construct( - - private ?CurrencyHelperInterface $helper = null, - ) - ``` - - `Sylius\Bundle\InventoryBundle\Twig\InventoryExtension` - ```diff - use Sylius\Component\Inventory\Checker\AvailabilityCheckerInterface; - - public function __construct( - - private AvailabilityCheckerInterface|InventoryHelper $helper, - + private AvailabilityCheckerInterface $availabilityChecker, - ) - ``` - - `Sylius\Bundle\LocaleBundle\Twig\LocaleExtension` - ```diff - use Sylius\Component\Locale\Context\LocaleContextInterface; - use Sylius\Component\Locale\Converter\LocaleConverterInterface; - - public function __construct( - - private LocaleConverterInterface|LocaleHelperInterface $localeHelper, - - private ?LocaleContextInterface $localeContext = null, - + private LocaleConverterInterface $localeConverter, - + private LocaleContextInterface $localeContext, - ) - ``` - - `Sylius\Bundle\MoneyBundle\Twig\ConvertMoneyExtension` - ```diff - use Sylius\Component\Currency\Converter\CurrencyConverterInterface; - - public function __construct( - - private ConvertMoneyHelperInterface|CurrencyConverterInterface $helper, - + private CurrencyConverterInterface $currencyConverter, - ) - ``` - - `Sylius\Bundle\MoneyBundle\Twig\FormatMoneyExtension` - ```diff - use Sylius\Bundle\MoneyBundle\Formatter\MoneyFormatterInterface; - - public function __construct( - - private private FormatMoneyHelperInterface|MoneyFormatterInterface $helper, - + private MoneyFormatterInterface $moneyFormatter, - ) - ``` - - `Sylius\Bundle\OrderBundle\Twig\AggregateAdjustmentsExtension` - ```diff - use Sylius\Component\Order\Aggregator\AdjustmentsAggregatorInterface; - - public function __construct( - - private AdjustmentsAggregatorInterface|AdjustmentsHelper $adjustmentsHelper, - + private AdjustmentsAggregatorInterface $adjustmentsAggregator, - ) - ``` - - `Sylius\Bundle\AdminBundle\Controller\DashboardController` - ```diff - public function __construct( - private ChannelRepositoryInterface $channelRepository, - private Environment $templatingEngine, - private RouterInterface $router, - - private ?StatisticsDataProviderInterface $statisticsDataProvider = null, - ) - ``` - - `Sylius\Bundle\AdminBundle\EventListener\AdminFilterSubscriber` - ```diff - - use Sylius\Bundle\UiBundle\Storage\FilterStorageInterface; - + use Sylius\Bundle\GridBundle\Storage\FilterStorageInterface; - - public function __construct(private FilterStorageInterface $filterStorage) - ``` - - `Sylius\Bundle\AdminBundle\Controller\RedirectHandler` - ```diff - - use Sylius\Bundle\UiBundle\Storage\FilterStorageInterface; - + use Sylius\Bundle\GridBundle\Storage\FilterStorageInterface; - - public function __construct( - private RedirectHandlerInterface $decoratedRedirectHandler, - private FilterStorageInterface $filterStorage, - ) - ``` - - `Sylius\Bundle\UiBundle\Twig\RedirectPathExtension` - ```diff - - use Sylius\Bundle\UiBundle\Storage\FilterStorageInterface; - + use Sylius\Bundle\GridBundle\Storage\FilterStorageInterface; - - public function __construct( - private FilterStorageInterface $filterStorage, - private RouterInterface $router, - ) - ``` - - `Sylius\Bundle\PayumBundle\Form\Extension\CryptedGatewayConfigTypeExtension` - ```diff - + use Sylius\Bundle\PayumBundle\Checker\PayumGatewayConfigEncryptionCheckerInterface; - - public function __construct( - + private readonly PayumGatewayConfigEncryptionCheckerInterface $encryptionChecker, - private ?CypherInterface $cypher = null, - ) - ``` - -## Grids - -The experimental `entities` filter has been removed. It has been replaced by the generic `entity` one. - -```diff -sylius_grid: - grids: - # ... - sylius_admin_catalog_promotion: - # ... - filters: - channel: -- type: entities -+ type: entity - label: sylius.ui.channel - form_options: - class: "%sylius.model.channel.class%" - options: -- field: product.channels.id -+ fields: [product.channels.id] -``` - -The following service has been removed: - - - sylius.grid_filter.entities - -## Security - -* API firewalls have been renamed and user checkers have been configured on firewalls - with `security.user_checker.chain.` service: - - ```diff - security: - firewalls: - admin: - ... - + user_checker: security.user_checker.chain.admin - - new_api_admin_user: - + api_admin: - ... - + user_checker: security.user_checker.chain.api_admin - - new_api_shop_user: - + api_shop: - ... - + user_checker: security.user_checker.chain.api_shop - shop: - ... - + user_checker: security.user_checker.chain.shop - ``` - -## Password Encoder & Salt -The encoder and salt has been removed from the User entities. It will use the password hasher configured on Symfony security configuration. - -This "encoder" is configured via the [Symfony security password hasher](https://symfony.com/doc/current/security/passwords.html#configuring-a-password-hasher). - -You may have already something like that configuration bellow. - -```yaml -# config/packages/security.yaml -security: - # ... - - password_hashers: - Sylius\Component\User\Model\UserInterface: argon2i -``` - -Check if you have an encoder configured in the `sylius_user` package configuration. - -```yaml -sylius_user: - # ... - - encoder: plaintext # Remove this line - - # ... - resources: - oauth: - user: - encoder: false # Remove this line - classes: Sylius\Component\User\Model\UserOAuth -``` - -Check your user hashed passwords in your production database. -In modern Symfony projects, the hasher name is stored on the password. - -Example: -`$argon2i$v=19$m=65536,t=4,p=1$VVJuMnpUUWhRY1daN1ppMA$2Tx6l3I+OUx+PUPn+vZz1jI3Z6l6IHh2kpG0NdpmYWE` - -If some of your users do not have the hasher name stored in the password field you may need to configure the "migrate_from" option into Symfony, following that documentation: -https://symfony.com/doc/current/security/passwords.html#configure-a-new-hasher-using-migrate-from - -Note: -If your app never changed the hasher name configuration, you don't need to configure this "migrate_from" configuration. - -## Directory structure - -* The Winzou state machine configuration file `state_machine.yml` has been moved from `@SyliusPaymentBundle/Resources/config/app` to `@SyliusPaymentBundle/Resources/config/app/state_machine` and renamed to `sylius_payment.yaml`. -* The Symfony workflow configuration file `state_machine.yaml` has been moved from `@SyliusPaymentBundle/Resources/config/workflow` to `@SyliusPaymentBundle/Resources/config/app/workflow` and renamed to `sylius_payment.yaml`. - -## Frontend - -* Unused, legacy node packages have been removed, while the required ones have been updated to newer versions. To ensure a smooth transition, it is recommended to delete the `node_modules` directory and reinstall the packages. +* Unused, legacy node packages have been removed, while the required ones have been updated to newer versions. + To ensure a smooth transition, it is recommended to delete the `node_modules` directory and reinstall the packages. * The recommended Node.js versions are 20 or 22, as support for version 18 has been dropped. * `use_webpack` option was removed from the `sylius_ui` configuration, and the Webpack has become the only module bundler provided by Sylius. * `use_webpack` twig global variable was removed. Webpack is always used now, and there is no need to check for it. - * Image sizes have been simplified and standardized for both the Admin and Shop Bundle. - * Some Twig extension services have been moved from the UiBundle to the new Twig Extra package -## Removal based on deprecations: +#### KNP Menu -### Classes and services +* Aliases for the `knp_menu.menu_builder` tags introduced in Sylius 1.14 are now the only valid menu builder tags in + Sylius 2.0: -* The following classes have been removed: - * **AdminBundle** - * `Sylius\Bundle\AdminBundle\Controller\Dashboard\StatisticsController` - * `Sylius\Bundle\AdminBundle\Form\Extension\CatalogPromotionActionTypeExtension` - * `Sylius\Bundle\AdminBundle\Form\Extension\CatalogPromotionScopeTypeExtension` - * `Sylius\Bundle\AdminBundle\Menu\CustomerShowMenuBuilder` - * `Sylius\Bundle\AdminBundle\Menu\OrderShowMenuBuilder` - * `Sylius\Bundle\AdminBundle\Menu\ProductFormMenuBuilder` - * `Sylius\Bundle\AdminBundle\Menu\ProductUpdateMenuBuilder` - * `Sylius\Bundle\AdminBundle\Menu\ProductVariantFormMenuBuilder` - * `Sylius\Bundle\AdminBundle\Menu\PromotionUpdateMenuBuilder` - * `Sylius\Bundle\AdminBundle\Provider\StatisticsDataProvider` - * `Sylius\Bundle\AdminBundle\Provider\StatisticsDataProviderInterface` - * **ApiBundle** - * `Sylius\Bundle\ApiBundle\ApiPlatform\ApiResourceConfigurationMerger` - * `Sylius\Bundle\ApiBundle\ApiPlatform\Bridge\Symfony\Routing\CachedRouteNameResolver` - * `Sylius\Bundle\ApiBundle\ApiPlatform\Bridge\Symfony\Routing\RouteNameResolver` - * `Sylius\Bundle\ApiBundle\ApiPlatform\Factory\MergingExtractorResourceMetadataFactory` - * `Sylius\Bundle\ApiBundle\ApiPlatform\Metadata\Merger\LegacyResourceMetadataMerger` - * `Sylius\Bundle\ApiBundle\ApiPlatform\ResourceMetadataPropertyValueResolver` - * `Sylius\Bundle\ApiBundle\Controller\GetAddressLogEntryCollectionAction` - * `Sylius\Bundle\ApiBundle\Controller\GetOrderAdjustmentsAction` - * `Sylius\Bundle\ApiBundle\Controller\UploadAvatarImageAction` - * `Sylius\Bundle\ApiBundle\Controller\UploadProductImageAction` - * `Sylius\Bundle\ApiBundle\Controller\UploadTaxonImageAction` - * `Sylius\Bundle\ApiBundle\DataPersister\AddressDataPersister` - * `Sylius\Bundle\ApiBundle\DataPersister\AdminUserDataPersister` - * `Sylius\Bundle\ApiBundle\DataPersister\ChannelDataPersister` - * `Sylius\Bundle\ApiBundle\DataPersister\CountryDataPersister` - * `Sylius\Bundle\ApiBundle\DataPersister\CustomerDataPersister` - * `Sylius\Bundle\ApiBundle\DataPersister\LocaleDataPersister` - * `Sylius\Bundle\ApiBundle\DataPersister\MessengerDataPersister` - * `Sylius\Bundle\ApiBundle\DataPersister\PaymentMethodDataPersister` - * `Sylius\Bundle\ApiBundle\DataPersister\ProductAttributeDataPersister` - * `Sylius\Bundle\ApiBundle\DataPersister\ProductDataPersister` - * `Sylius\Bundle\ApiBundle\DataPersister\ProductTaxonDataPersister` - * `Sylius\Bundle\ApiBundle\DataPersister\ProductVariantDataPersister` - * `Sylius\Bundle\ApiBundle\DataPersister\PromotionCouponDataPersister` - * `Sylius\Bundle\ApiBundle\DataPersister\PromotionDataPersister` - * `Sylius\Bundle\ApiBundle\DataPersister\ShippingMethodDataPersister` - * `Sylius\Bundle\ApiBundle\DataPersister\TranslatableDataPersister` - * `Sylius\Bundle\ApiBundle\DataPersister\ZoneDataPersister` - * `Sylius\Bundle\ApiBundle\DataProvider\AccountResetPasswordItemDataProvider` - * `Sylius\Bundle\ApiBundle\DataProvider\AdminOrderItemAdjustmentsSubresourceDataProvider` - * `Sylius\Bundle\ApiBundle\DataProvider\AdminResetPasswordItemDataProvider` - * `Sylius\Bundle\ApiBundle\DataProvider\ChannelAwareItemDataProvider` - * `Sylius\Bundle\ApiBundle\DataProvider\ChannelsCollectionDataProvider` - * `Sylius\Bundle\ApiBundle\DataProvider\CustomerItemDataProvider` - * `Sylius\Bundle\ApiBundle\DataProvider\OrderAdjustmentsSubresourceDataProvider` - * `Sylius\Bundle\ApiBundle\DataProvider\OrderItemAdjustmentsSubresourceDataProvider` - * `Sylius\Bundle\ApiBundle\DataProvider\OrderItemItemDataProvider` - * `Sylius\Bundle\ApiBundle\DataProvider\OrderItemUnitItemDataProvider` - * `Sylius\Bundle\ApiBundle\DataProvider\PaymentItemDataProvider` - * `Sylius\Bundle\ApiBundle\DataProvider\PaymentMethodsCollectionDataProvider` - * `Sylius\Bundle\ApiBundle\DataProvider\ProductAttributesSubresourceDataProvider` - * `Sylius\Bundle\ApiBundle\DataProvider\ProductItemDataProvider` - * `Sylius\Bundle\ApiBundle\DataProvider\ShipmentItemDataProvider` - * `Sylius\Bundle\ApiBundle\DataProvider\ShippingMethodsCollectionDataProvider` - * `Sylius\Bundle\ApiBundle\DataProvider\VerifyCustomerAccountItemDataProvider` - * `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` - * `Sylius\Bundle\ApiBundle\Filter\Doctrine\PromotionCouponPromotionFilter` - * `Sylius\Bundle\ApiBundle\Filter\PaymentMethodFilter` - * `Sylius\Bundle\ApiBundle\Filter\ShippingMethodFilter` - * `Sylius\Bundle\ApiBundle\QueryHandler\GetAddressLogEntryCollectionHandler` - * `Sylius\Bundle\ApiBundle\Serializer\FlattenExceptionNormalizer` - * `Sylius\Bundle\ApiBundle\SerializerContextBuilder\ReadOperationContextBuilder` - * `Sylius\Bundle\ApiBundle\Validator\Constraints\AccountVerificationTokenEligibilityValidator` - * `Sylius\Bundle\ApiBundle\Validator\ResourceApiInputDataPropertiesValidator` - * `Sylius\Bundle\ApiBundle\Validator\ResourceInputDataPropertiesValidatorInterface` - * `Sylius\Bundle\ApiBundle\EventListener\PostgreSQLDriverExceptionListener` - * `Sylius\Bundle\ApiBundle\DataTransformer\ChannelCodeAwareInputCommandDataTransformer` - * `Sylius\Bundle\ApiBundle\DataTransformer\CommandAwareInputDataTransformer` - * `Sylius\Bundle\ApiBundle\DataTransformer\CommandDataTransformerInterface` - * `Sylius\Bundle\ApiBundle\DataTransformer\LocaleCodeAwareInputCommandDataTransformer` - * `Sylius\Bundle\ApiBundle\DataTransformer\LoggedInCustomerEmailAwareCommandDataTransformer` - * `Sylius\Bundle\ApiBundle\DataTransformer\LoggedInCustomerEmailIfNotSetAwareCommandDataTransformer` - * `Sylius\Bundle\ApiBundle\DataTransformer\LoggedInShopUserIdAwareCommandDataTransformer` - * `Sylius\Bundle\ApiBundle\DataTransformer\OrderTokenValueAwareInputCommandDataTransformer` - * `Sylius\Bundle\ApiBundle\DataTransformer\ShipmentIdAwareInputCommandDataTransformer` - * `Sylius\Bundle\ApiBundle\DataTransformer\SubresourceIdAwareCommandDataTransformer` - * `api_platform.action.post_item` - * **CoreBundle** - * `Sylius\Bundle\CoreBundle\Console\Command\Model\PluginInfo` - * `Sylius\Bundle\CoreBundle\Console\Command\ShowAvailablePluginsCommand` - * `Sylius\Bundle\CoreBundle\Form\Extension\CountryTypeExtension` - * `Sylius\Bundle\CoreBundle\Form\Extension\CustomerTypeExtension` - * `Sylius\Bundle\CoreBundle\Form\Extension\LocaleTypeExtension` - * `Sylius\Bundle\CoreBundle\Form\Type\Grid\Filter\EntitiesFilterType` - * `Sylius\Bundle\CoreBundle\Form\EventSubscriber\AddUserFormSubscriber` - * `Sylius\Bundle\CoreBundle\Twig\StateMachineExtension` - * `Sylius\Component\Core\Grid\Filter\EntitiesFilter` - * `Sylius\Component\Core\Dashboard\DashboardStatistics` - * `Sylius\Component\Core\Dashboard\DashboardStatisticsProvider` - * `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` - * **PayumBundle** - * `Sylius\Bundle\PayumBundle\Action\Paypal\ExpressCheckout\ConvertPaymentAction` - * `Sylius\Bundle\PayumBundle\Controller\PayumController` - * `Sylius\Bundle\PayumBundle\Form\Type\PaypalGatewayConfigurationType` - * `Sylius\Bundle\PayumBundle\Form\Type\StripeGatewayConfigurationType` - * **UiBundle** - * `Sylius\Bundle\UiBundle\Console\Command\DebugTemplateEventCommand` - * `Sylius\Bundle\UiBundle\ContextProvider\ContextProviderInterface` - * `Sylius\Bundle\UiBundle\ContextProvider\DefaultContextProvider` - * `Sylius\Bundle\UiBundle\DataCollector\TemplateBlockDataCollector` - * `Sylius\Bundle\UiBundle\DataCollector\TemplateBlockRenderingHistory` - * `Sylius\Bundle\UiBundle\DataCollector\TraceableTemplateBlockRenderer` - * `Sylius\Bundle\UiBundle\DataCollector\TraceableTemplateEventRenderer` - * `Sylius\Bundle\UiBundle\Registry\TemplateBlock` - * `Sylius\Bundle\UiBundle\Registry\TemplateBlockRegistry` - * `Sylius\Bundle\UiBundle\Registry\TemplateBlockRegistryInterface` - * `Sylius\Bundle\UiBundle\Renderer\DelegatingTemplateEventRenderer` - * `Sylius\Bundle\UiBundle\Renderer\HtmlDebugTemplateBlockRenderer` - * `Sylius\Bundle\UiBundle\Renderer\HtmlDebugTemplateEventRenderer` - * `Sylius\Bundle\UiBundle\Renderer\TemplateBlockRendererInterface` - * `Sylius\Bundle\UiBundle\Renderer\TemplateEventRendererInterface` - * `Sylius\Bundle\UiBundle\Renderer\TwigTemplateBlockRenderer` - * `Sylius\Bundle\UiBundle\Storage\FilterStorage` - * `Sylius\Bundle\UiBundle\Storage\FilterStorageInterface` - * `Sylius\Bundle\UiBundle\Twig\LegacySonataBlockExtension` - * `Sylius\Bundle\UiBundle\Twig\SortByExtension` - * `Sylius\Bundle\UiBundle\Twig\TemplateEventExtension` - * `Sylius\Bundle\UiBundle\Twig\TestFormAttributeExtension` - * `Sylius\Bundle\UiBundle\Twig\TestHtmlAttributeExtension` +| Old Alias | New Alias | +|-----------------------|-----------------------| +| **AdminBundle** | | +| `sylius.admin.main` | `sylius_admin.main` | +| **ShopBundle** | | +| `sylius.shop.account` | `sylius_shop.account` | -### Routes +#### Transition from SemanticUI to Bootstrap -* The following routes have been removed: - * `sylius_admin_dashboard_statistics` - * `sylius_admin_ajax_all_product_variants_by_codes` - * `sylius_admin_ajax_all_product_variants_by_phrase` - * `sylius_admin_ajax_customer_group_by_code` - * `sylius_admin_ajax_customer_groups_by_phrase` - * `sylius_admin_ajax_find_product_options` - * `sylius_admin_ajax_generate_product_slug` - * `sylius_admin_ajax_generate_taxon_slug` - * `sylius_admin_ajax_product_by_code` - * `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_taxon_by_code` - * `sylius_admin_ajax_taxon_by_name_phrase` - * `sylius_admin_ajax_taxon_leafs` - * `sylius_admin_ajax_taxon_root_nodes` - * `sylius_admin_dashboard_statistics` - * `sylius_admin_get_attribute_types` - * `sylius_admin_get_payment_gateways` - * `sylius_admin_get_product_attributes` - * `sylius_admin_partial_address_log_entry_index` - * `sylius_admin_partial_catalog_promotion_show` - * `sylius_admin_partial_channel_index` - * `sylius_admin_partial_customer_latest` - * `sylius_admin_partial_customer_show` - * `sylius_admin_partial_order_latest` - * `sylius_admin_partial_order_latest_in_channel` - * `sylius_admin_partial_product_show` - * `sylius_admin_partial_promotion_show` - * `sylius_admin_partial_taxon_show` - * `sylius_admin_partial_taxon_tree` - * `sylius_admin_render_attribute_forms` - * `sylius_shop_ajax_cart_add_item` - * `sylius_shop_ajax_cart_item_remove` - * `sylius_shop_ajax_user_check_action` - * `sylius_shop_partial_cart_summary` - * `sylius_shop_partial_cart_add_item` - * `sylius_shop_partial_channel_menu_taxon_index` - * `sylius_shop_partial_product_association_show` - * `sylius_shop_partial_product_index_latest` - * `sylius_shop_partial_product_review_latest` - * `sylius_shop_partial_product_show_by_slug` - * `sylius_shop_partial_taxon_index_by_code` - * `sylius_shop_partial_taxon_show_by_slug` - -* The following services have been renamed: - * `sylius.twig.extension.form_test_attribute_array` => `sylius_twig_extra.twig.extension.test_form_attribute` - * `sylius.twig.extension.form_test_attribute_name` => `sylius_twig_extra.twig.extension.test_html_attribute` - * `sylius.twig.extension.sort_by` => `sylius_twig_extra.twig.extension.sort_by` - * `Sylius\Bundle\UiBundle\Twig\RouteExistsExtension` => `sylius_twig_extra.twig.extension.route_exists` - -## Payment method gateways - -* Stripe gateway has been removed. This implementation has been deprecated and not SCA Ready. -* PayPal Express Checkout gateway has been removed. Use now [PayPal Commerce Platform](https://github.com/Sylius/PayPalPlugin) integration. - -## Theming -* Dependency on `sylius/theme-bundle` is moved from CoreBundle to ShopBundle and it will no longer be installed - if you're running your shop in headless mode. -* Channel's `themeName` form field existence is made optional and depends on `ShopBundle` presence. -* The `Sylius\Bundle\CoreBundle\Theme\ChannelBasedThemeContext` has been moved to the `Sylius\Bundle\ShopBundle\Theme\ChannelBasedThemeContext`. - -## Routing - -* Routing for the `sylius_shop_payum` has been moved from the `SyliusShopBundle` to the `SyliusPayumBundle`: - -```yaml -sylius_shop_payum: -- resource: "@SyliusShopBundle/Resources/config/routing/payum.yml" -+ resource: "@SyliusPayumBundle/Resources/config/routing/integrations/sylius_shop.yaml" -``` - -## Testing Suite - -* The `sylius.behat.api_security` has been replaced by `sylius.behat.api_admin_security` and `sylius.behat.api_shop_security` services. - -## Templates changes - -### Transition from SemanticUI to Bootstrap - -- All `.ui` prefixed classes have been replaced with Bootstrap classes. +- All CSS classes of SemanticUI have been replaced with Bootstrap classes. - JavaScript components relying on Semantic UI have been rewritten to utilize Bootstrap's JavaScript plugins. - Customized CSS has been replaced by Bootstrap's utility classes. -### Abandoning jQuery +#### Removal of jQuery Most of the existing JavaScript has been replaced by SymfonyUX with Stimulus, which includes live components. This change led to the removal of jQuery and a significant reduction of custom JavaScript in the project. Check out the documentation for more information [here](https://ux.symfony.com/). -### Abandoning partial routes +#### Abandoning partial routes All partial routes rendered in templates have been removed and replaced by rendering Twig components. -### Sylius Twig Hooks +#### Sylius Twig Hooks Twig Hooks are a robust and powerful alternative to the Sonata Block Events and the old Sylius Template Events systems. -#### Abandoning Sonata Blocks +##### Removal of Sonata Blocks -Sonata Blocks have been fully replaced with Twig Hooks. +Sonata Blocks have been fully removed as they were not actively maintained/supported for a long time. -#### Evolving Sylius Template Events to Twig Hooks +##### Evolving Sylius Template Events to Twig Hooks Sylius Twig Hooks is a new generation of template customization and extension, providing: @@ -1491,10 +1634,12 @@ Sylius Twig Hooks is a new generation of template customization and extension, p - A priority mechanism to control rendering order. - Simple enable/disable options for each hook. -##### Key Improvements in Sylius Twig Hooks +1. Key Improvements in Sylius Twig Hooks **Improved Structure** +- **Hooks** + Previously, all template events were configured in a single, monolithic `events.yaml` file, making it difficult to navigate and maintain: ``` @@ -1504,7 +1649,8 @@ Previously, all template events were configured in a single, monolithic `events. /events.yaml ``` -With Twig Hooks, the configuration has been reorganized into smaller, more manageable files. Each file corresponds to a specific part of the application, enhancing clarity and maintainability: +With Twig Hooks, the configuration has been reorganized into smaller, more manageable files. Each file corresponds +to a specific part of the application, enhancing clarity and maintainability: ``` /app @@ -1518,7 +1664,44 @@ With Twig Hooks, the configuration has been reorganized into smaller, more manag /show.yaml ``` -##### Detailed Comparison: Old vs. New configurations +- **Templates** + +The structure of the template directories has also been improved. Previously, templates were organized in a less intuitive way, +with some structures inconsistent with the template event definitions: + +``` +/resources + /views + /AdminUser + /Crud + /Product + /Form + /_avatarImage.html.twig + /_form.html.twig +``` + +Now, the templates are organized in a more consistent manner, with all templates grouped by resource and aligned +with hook naming conventions: + +``` +/templates + /product + /form + /sections + /translations + description.html.twig + meta_description.html.twig + meta_keywords.html.twig + name.html.twig + short_description.html.twig + slug.html.twig + /translations.html.twig + /show + /shared + /another_resource +``` + +1. Detailed Comparison: Old vs. New configurations **Old configuration (Template Events)** @@ -1629,3 +1812,9 @@ sylius_twig_hooks: Twig Hooks cover both the admin and shop areas comprehensively, ensuring consistency across the entire application. AdminBundle hooks start with the `sylius_admin` prefix, while ShopBundle hooks start with the `sylius_shop` prefix. +For more information visit the [Sylius Stack](https://github.com/Sylius/Stack). + +### Testing Suite + +* The `sylius.behat.api_security` has been replaced by `sylius.behat.api_admin_security` and `sylius.behat.api_shop_security` services. +* We removed `Psalm`, the `PHPStan` is now the only static analysis tool used in the project. diff --git a/config/bundles.php b/config/bundles.php index fdf7ad08c3..08ac0591a5 100644 --- a/config/bundles.php +++ b/config/bundles.php @@ -44,12 +44,12 @@ return [ Sylius\Bundle\ShopBundle\SyliusShopBundle::class => ['all' => true], ApiPlatform\Symfony\Bundle\ApiPlatformBundle::class => ['all' => true], Sylius\Bundle\ApiBundle\SyliusApiBundle::class => ['all' => true], - Symfony\Bundle\DebugBundle\DebugBundle::class => ['dev' => true, 'test' => true, 'test_cached' => true, 'test_cached_payum' => true], - Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => true, 'test' => true, 'test_cached' => true, 'test_cached_payum' => true], - Fidry\AliceDataFixtures\Bridge\Symfony\FidryAliceDataFixturesBundle::class => ['dev' => true, 'test' => true, 'test_cached' => true, 'test_cached_payum' => true], - Nelmio\Alice\Bridge\Symfony\NelmioAliceBundle::class => ['dev' => true, 'test' => true, 'test_cached' => true, 'test_cached_payum' => true], - FriendsOfBehat\SymfonyExtension\Bundle\FriendsOfBehatSymfonyExtensionBundle::class => ['test' => true, 'test_cached' => true, 'test_cached_payum' => true], - Sylius\Behat\Application\SyliusTestPlugin\SyliusTestPlugin::class => ['test' => true, 'test_cached' => true, 'test_cached_payum' => true], + Symfony\Bundle\DebugBundle\DebugBundle::class => ['dev' => true, 'test' => true, 'test_cached' => true], + Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => true, 'test' => true, 'test_cached' => true], + Fidry\AliceDataFixtures\Bridge\Symfony\FidryAliceDataFixturesBundle::class => ['dev' => true, 'test' => true, 'test_cached' => true], + Nelmio\Alice\Bridge\Symfony\NelmioAliceBundle::class => ['dev' => true, 'test' => true, 'test_cached' => true], + FriendsOfBehat\SymfonyExtension\Bundle\FriendsOfBehatSymfonyExtensionBundle::class => ['test' => true, 'test_cached' => true], + Sylius\Behat\Application\SyliusTestPlugin\SyliusTestPlugin::class => ['test' => true, 'test_cached' => true], Lexik\Bundle\JWTAuthenticationBundle\LexikJWTAuthenticationBundle::class => ['all' => true], SyliusLabs\DoctrineMigrationsExtraBundle\SyliusLabsDoctrineMigrationsExtraBundle::class => ['all' => true], Symfony\WebpackEncoreBundle\WebpackEncoreBundle::class => ['all' => true], diff --git a/config/packages/test_cached_payum/_sylius.yaml b/config/packages/test_cached_payum/_sylius.yaml deleted file mode 100644 index c37a7353a0..0000000000 --- a/config/packages/test_cached_payum/_sylius.yaml +++ /dev/null @@ -1,2 +0,0 @@ -imports: - - { resource: "../test_cached/_sylius.yaml" } diff --git a/config/packages/test_cached_payum/doctrine.yaml b/config/packages/test_cached_payum/doctrine.yaml deleted file mode 100644 index c3263c8bb9..0000000000 --- a/config/packages/test_cached_payum/doctrine.yaml +++ /dev/null @@ -1,2 +0,0 @@ -imports: - - { resource: "../test_cached/doctrine.yaml" } diff --git a/config/packages/test_cached_payum/fidry_alice_data_fixtures.yaml b/config/packages/test_cached_payum/fidry_alice_data_fixtures.yaml deleted file mode 100644 index dc171f69eb..0000000000 --- a/config/packages/test_cached_payum/fidry_alice_data_fixtures.yaml +++ /dev/null @@ -1,2 +0,0 @@ -imports: - - { resource: "../test_cached/fidry_alice_data_fixtures.yaml" } diff --git a/config/packages/test_cached_payum/framework.yaml b/config/packages/test_cached_payum/framework.yaml deleted file mode 100644 index 8ced67a150..0000000000 --- a/config/packages/test_cached_payum/framework.yaml +++ /dev/null @@ -1,2 +0,0 @@ -imports: - - { resource: "../test_cached/framework.yaml" } diff --git a/config/packages/test_cached_payum/mailer.yaml b/config/packages/test_cached_payum/mailer.yaml deleted file mode 100644 index 3397f9db95..0000000000 --- a/config/packages/test_cached_payum/mailer.yaml +++ /dev/null @@ -1,2 +0,0 @@ -imports: - - { resource: "../test_cached/mailer.yaml" } diff --git a/config/packages/test_cached_payum/monolog.yaml b/config/packages/test_cached_payum/monolog.yaml deleted file mode 100644 index 287961d338..0000000000 --- a/config/packages/test_cached_payum/monolog.yaml +++ /dev/null @@ -1,2 +0,0 @@ -imports: - - { resource: "../test_cached/monolog.yaml" } diff --git a/config/packages/test_cached_payum/nelmio_alice.yaml b/config/packages/test_cached_payum/nelmio_alice.yaml deleted file mode 100644 index caec543dea..0000000000 --- a/config/packages/test_cached_payum/nelmio_alice.yaml +++ /dev/null @@ -1,2 +0,0 @@ -imports: - - { resource: ../dev/nelmio_alice.yaml } diff --git a/config/packages/test_cached_payum/security.yaml b/config/packages/test_cached_payum/security.yaml deleted file mode 100644 index 325f82c0dd..0000000000 --- a/config/packages/test_cached_payum/security.yaml +++ /dev/null @@ -1,2 +0,0 @@ -imports: - - { resource: "../test_cached/security.yaml" } diff --git a/config/packages/test_cached_payum/sylius_channel.yaml b/config/packages/test_cached_payum/sylius_channel.yaml deleted file mode 100644 index 8498632aff..0000000000 --- a/config/packages/test_cached_payum/sylius_channel.yaml +++ /dev/null @@ -1,2 +0,0 @@ -imports: - - { resource: "../test_cached/sylius_channel.yaml" } diff --git a/config/packages/test_cached_payum/sylius_theme.yaml b/config/packages/test_cached_payum/sylius_theme.yaml deleted file mode 100644 index 50898d6766..0000000000 --- a/config/packages/test_cached_payum/sylius_theme.yaml +++ /dev/null @@ -1,2 +0,0 @@ -imports: - - { resource: "../test_cached/sylius_theme.yaml" } diff --git a/config/packages/test_cached_payum/sylius_uploader.yaml b/config/packages/test_cached_payum/sylius_uploader.yaml deleted file mode 100644 index 430da6ead1..0000000000 --- a/config/packages/test_cached_payum/sylius_uploader.yaml +++ /dev/null @@ -1,2 +0,0 @@ -imports: - - { resource: "../test_cached/sylius_uploader.yaml" } diff --git a/config/packages/test_cached_payum/twig.yaml b/config/packages/test_cached_payum/twig.yaml deleted file mode 100644 index 79615ca899..0000000000 --- a/config/packages/test_cached_payum/twig.yaml +++ /dev/null @@ -1,2 +0,0 @@ -imports: - - { resource: "../test_cached/twig.yaml" } diff --git a/config/packages/test_cached_payum/web_profiler.yaml b/config/packages/test_cached_payum/web_profiler.yaml deleted file mode 100644 index cc60840683..0000000000 --- a/config/packages/test_cached_payum/web_profiler.yaml +++ /dev/null @@ -1,2 +0,0 @@ -imports: - - { resource: "../test_cached/web_profiler.yaml" } diff --git a/config/packages/test_cached_payum/webpack_encore.yaml b/config/packages/test_cached_payum/webpack_encore.yaml deleted file mode 100644 index 7dedf7a728..0000000000 --- a/config/packages/test_cached_payum/webpack_encore.yaml +++ /dev/null @@ -1,2 +0,0 @@ -imports: - - { resource: "../test_cached/webpack_encore.yaml" } diff --git a/config/services_test_cached_payum.yaml b/config/services_test_cached_payum.yaml deleted file mode 100644 index 5ab0178f66..0000000000 --- a/config/services_test_cached_payum.yaml +++ /dev/null @@ -1,11 +0,0 @@ -imports: - - { resource: "services_test_cached.yaml" } - -services: - # Prioritize Payum by tagging services with a higher priority (or lower for tagged_iterator). - 'sylius_payum.command_provider.payment_request.offline': - class: Sylius\Bundle\PaymentBundle\CommandProvider\ActionsCommandProvider - arguments: - - !tagged_locator { tag: 'sylius_payum.command_provider.payment_request.offline', index_by: 'action' } - tags: - - { name: 'sylius.payment_request.command_provider', gateway-factory: 'offline', priority: -100 } diff --git a/features/hybrid/checkout/changing_payment_method/cancelling_payment_request_when_payment_method_is_changed.feature b/features/hybrid/checkout/changing_payment_method/cancelling_payment_request_when_payment_method_is_changed.feature index 6c4bb94766..46647937e2 100644 --- a/features/hybrid/checkout/changing_payment_method/cancelling_payment_request_when_payment_method_is_changed.feature +++ b/features/hybrid/checkout/changing_payment_method/cancelling_payment_request_when_payment_method_is_changed.feature @@ -22,7 +22,7 @@ Feature: Cancelling payment request when payment method is changed @api @ui Scenario: Cancelling only not finalized payment requests when the payment method has changed - When I browse my orders + When I want to browse order details for this order And I change my payment method to "Bank Transfer" Then the administrator should see the payment request with action "authorize" for "Cash on Delivery" payment method and state "cancelled" And the administrator should see the payment request with action "status" for "Cash on Delivery" payment method and state "cancelled" diff --git a/features/shop/account/customer_account/viewing_orders_history/changing_payment_method.feature b/features/shop/account/customer_account/viewing_orders_history/changing_payment_method.feature index e0ccbd04a3..b1820bd541 100644 --- a/features/shop/account/customer_account/viewing_orders_history/changing_payment_method.feature +++ b/features/shop/account/customer_account/viewing_orders_history/changing_payment_method.feature @@ -18,13 +18,13 @@ Feature: Changing a payment method of a placed order @api @ui Scenario: Changing a payment method of an order - When I browse my orders + When I want to browse order details for this order And I change my payment method to "Bank Transfer" Then I should have "Bank Transfer" payment method on my order @api @ui Scenario: Changing a payment method of an order with a disabled payment method Given the payment method "Cash on Delivery" is disabled - When I browse my orders + When I want to browse order details for this order And I change my payment method to "Bank Transfer" Then I should have "Bank Transfer" payment method on my order diff --git a/features/shop/checkout/paying_for_order/cancelling_payment_request_when_payment_method_is_changed.feature b/features/shop/checkout/paying_for_order/cancelling_payment_request_when_payment_method_is_changed.feature index 055289e0af..31175da482 100644 --- a/features/shop/checkout/paying_for_order/cancelling_payment_request_when_payment_method_is_changed.feature +++ b/features/shop/checkout/paying_for_order/cancelling_payment_request_when_payment_method_is_changed.feature @@ -9,7 +9,9 @@ Feature: Cancelling payment request when payment method is changed And the store has a product "PHP T-Shirt" And the store ships everywhere for Free And the store allows paying with "Cash on Delivery" + And this payment method is not using Payum And the store also allows paying with "Bank Transfer" + And this payment method is not using Payum And I am a logged in customer And I placed an order "#00000001" And I bought a single "PHP T-Shirt" @@ -19,10 +21,10 @@ Feature: Cancelling payment request when payment method is changed And there is also a "processing" "status" payment request for order "#00000001" using the "Cash on Delivery" payment method And there is also a "completed" "capture" payment request for order "#00000001" using the "Cash on Delivery" payment method - @api @no-ui + @api @ui Scenario: Cancelling only not finalized payment requests when the payment method has changed - When I view the summary of my order "#00000001" - And I change payment method to "Bank Transfer" after checkout - Then my payment request with action "authorize" for payment method "Cash on Delivery" should have state "cancelled" - And my payment request with action "status" for payment method "Cash on Delivery" should have state "cancelled" - And my payment request with action "capture" for payment method "Cash on Delivery" should have state "completed" + When I want to browse order details for this order + And I change my payment method to "Bank Transfer" + Then a payment request with action "authorize" for payment method "Cash on Delivery" should have state "cancelled" + And a payment request with action "status" for payment method "Cash on Delivery" should have state "cancelled" + And a payment request with action "capture" for payment method "Cash on Delivery" should have state "completed" diff --git a/features/shop/checkout/paying_for_order/paying_offline_during_checkout.feature b/features/shop/checkout/paying_for_order/paying_offline_during_checkout.feature index bc84b15545..b575ff12a9 100644 --- a/features/shop/checkout/paying_for_order/paying_offline_during_checkout.feature +++ b/features/shop/checkout/paying_for_order/paying_offline_during_checkout.feature @@ -12,6 +12,16 @@ Feature: Paying offline during checkout @api @ui @javascript Scenario: Successfully placing an order + Given I am a logged in customer + And this payment method is not using Payum + And I have product "PHP T-Shirt" in the cart + And I have specified the billing address as "Ankh Morpork", "Frost Alley", "90210", "United States" for "Jon Snow" + When I proceeded with "Free" shipping method and "Offline" payment method + And I confirm my order + Then I should see the thank you page + + @api @ui @javascript + Scenario: Using Payum successfully placing an order Given I am a logged in customer And I have product "PHP T-Shirt" in the cart And I have specified the billing address as "Ankh Morpork", "Frost Alley", "90210", "United States" for "Jon Snow" diff --git a/features/shop/checkout/paying_for_order/paying_offline_during_checkout_as_guest.feature b/features/shop/checkout/paying_for_order/paying_offline_during_checkout_as_guest.feature index 1b849a126c..581d022409 100644 --- a/features/shop/checkout/paying_for_order/paying_offline_during_checkout_as_guest.feature +++ b/features/shop/checkout/paying_for_order/paying_offline_during_checkout_as_guest.feature @@ -13,6 +13,16 @@ Feature: Paying Offline during checkout as guest @api @ui @javascript Scenario: Successfully placing an order + Given this payment method is not using Payum + And I have product "PHP T-Shirt" in the cart + When I complete addressing step with email "john@example.com" and "United States" based billing address + And I proceed with "Free" shipping method + And I choose "Offline" payment method + And I confirm my order + Then I should see the thank you page + + @api @ui @javascript + Scenario: Using Payum successfully placing an order Given I have product "PHP T-Shirt" in the cart When I complete addressing step with email "john@example.com" and "United States" based billing address And I proceed with "Free" shipping method @@ -22,6 +32,14 @@ Feature: Paying Offline during checkout as guest @no-api @ui @javascript Scenario: Successfully placing an order using custom locale + Given this payment method is not using Payum + And I have product "PHP T-Shirt" in the cart + When I proceed through checkout process in the "French (France)" locale with email "john@example.com" + And I confirm my order + Then I should see the thank you page in "French (France)" + + @no-api @ui @javascript + Scenario: Using Payum successfully placing an order using custom locale Given I have product "PHP T-Shirt" in the cart When I proceed through checkout process in the "French (France)" locale with email "john@example.com" And I confirm my order @@ -29,6 +47,15 @@ Feature: Paying Offline during checkout as guest @api @no-ui Scenario: Successfully placing an order using custom locale + Given this payment method is not using Payum + And I pick up cart in the "French (France)" locale + And I add product "PHP T-Shirt" to the cart + When I proceed through checkout process + And I confirm my order + Then my order's locale should be "French (France)" + + @api @no-ui + Scenario: Using Payum successfully placing an order using custom locale Given I pick up cart in the "French (France)" locale And I add product "PHP T-Shirt" to the cart When I proceed through checkout process diff --git a/features/shop/checkout/paying_for_order/preventing_changing_the_payment_method_of_a_cancelled_order.feature b/features/shop/checkout/paying_for_order/preventing_changing_the_payment_method_of_a_cancelled_order.feature index ffc2a4f670..6ae4e72277 100644 --- a/features/shop/checkout/paying_for_order/preventing_changing_the_payment_method_of_a_cancelled_order.feature +++ b/features/shop/checkout/paying_for_order/preventing_changing_the_payment_method_of_a_cancelled_order.feature @@ -15,10 +15,10 @@ Feature: Preventing changing the payment method of a cancelled order And I bought a single "Angel T-Shirt" And I addressed it to "Lucifer Morningstar", "Seaside Fwy", "90802" "Los Angeles" in the "United States" with identical billing address And I chose "Free" shipping method with "Cash on Delivery" payment - And I am changing this order's payment method And this order was cancelled @api @ui Scenario: Being prevented from changing the payment method of a cancelled order - When I try to change my payment method to "Bank Transfer" + When I want to browse order details for this order + And I try to change my payment method to "Bank Transfer" Then I should be notified that I can no longer change payment method of this order diff --git a/features/shop/checkout/paying_for_order/seeing_payment_method_instructions_after_checkout.feature b/features/shop/checkout/paying_for_order/seeing_payment_method_instructions_after_checkout.feature index c8eefc75e4..57af7a9e85 100644 --- a/features/shop/checkout/paying_for_order/seeing_payment_method_instructions_after_checkout.feature +++ b/features/shop/checkout/paying_for_order/seeing_payment_method_instructions_after_checkout.feature @@ -13,6 +13,15 @@ Feature: Seeing payment method instructions after checkout @api @ui @javascript Scenario: Being informed about payment instructions + Given I am a logged in customer + And this payment method is not using Payum + And I have product "PHP T-Shirt" in the cart + When I proceed with selecting "Offline" payment method + And I confirm my order + Then I should be informed with "Offline" payment method instructions + + @api @ui @javascript + Scenario: Using Payum being informed about payment instructions Given I am a logged in customer And I have product "PHP T-Shirt" in the cart When I proceed with selecting "Offline" payment method diff --git a/features/shop/checkout/paying_for_order/selecting_order_payment_method.feature b/features/shop/checkout/paying_for_order/selecting_order_payment_method.feature index 4cbb494852..6ef312cd1d 100644 --- a/features/shop/checkout/paying_for_order/selecting_order_payment_method.feature +++ b/features/shop/checkout/paying_for_order/selecting_order_payment_method.feature @@ -13,6 +13,17 @@ Feature: Selecting an order payment method @api @ui @javascript Scenario: Selecting a payment method + Given this payment method is not using Payum + And I have product "PHP T-Shirt" in the cart + And I specified the billing address as "Ankh Morpork", "Frost Alley", "90210", "United States" for "Jon Snow" + And I select "Free" shipping method + And I complete the shipping step + When I select "Bank transfer" payment method + And I complete the payment step + Then I should be on the checkout complete step + + @api @ui @javascript + Scenario: Using Payum selecting a payment method Given I have product "PHP T-Shirt" in the cart And I specified the billing address as "Ankh Morpork", "Frost Alley", "90210", "United States" for "Jon Snow" And I select "Free" shipping method diff --git a/features/shop/payment_request/calling_notify_for_a_payment_method.feature b/features/shop/payment_request/calling_notify_for_a_payment_method.feature index eb91f690de..da553d5038 100644 --- a/features/shop/payment_request/calling_notify_for_a_payment_method.feature +++ b/features/shop/payment_request/calling_notify_for_a_payment_method.feature @@ -13,13 +13,28 @@ Feature: Calling notify for a payment method @ui Scenario: I want to send HTTP request to the payment method notify and succeeded + Given this payment method is not using Payum When I call the payment method notify page with the code "offline" - Then a payment request with "notify" action and state "completed" should exists + Then a payment request with action "notify" for payment method "Offline" should have state "completed" And the response status code should be 204 And the response content should be empty @ui Scenario: I want to send HTTP request to the payment method notify and failed + Given this payment method is not using Payum + When I call the payment method notify page with the code "not_existing" + Then no payment request with "notify" action should exists + And the response status code should be 404 + + @ui + Scenario: Using Payum I want to send HTTP request to the payment method notify and succeeded + When I call the payment method notify page with the code "offline" + Then a payment request with action "notify" for payment method "Offline" should have state "completed" + And the response status code should be 204 + And the response content should be empty + + @ui + Scenario: Using Payum I want to send HTTP request to the payment method notify and failed When I call the payment method notify page with the code "not_existing" Then no payment request with "notify" action should exists And the response status code should be 404 diff --git a/features/shop/payment_request/calling_notify_for_a_payment_request.feature b/features/shop/payment_request/calling_notify_for_a_payment_request.feature index 4b6c048fc3..4a1831e4f1 100644 --- a/features/shop/payment_request/calling_notify_for_a_payment_request.feature +++ b/features/shop/payment_request/calling_notify_for_a_payment_request.feature @@ -14,16 +14,33 @@ Feature: Calling notify for a payment method @ui Scenario: I want to send HTTP request to the payment request notify and succeeded - Given there is a "new" "notify" payment request for order "#000001" using the "Offline" payment method + Given this payment method is not using Payum + And there is a "new" "notify" payment request for order "#000001" using the "Offline" payment method When I call the payment request notify page for this payment request - Then a payment request with "notify" action and state "completed" should exists + Then a payment request with action "notify" for payment method "Offline" should have state "completed" And the response status code should be 204 And the response content should be empty @ui Scenario: I want to send HTTP request to the payment method notify and failed - Given there is a "completed" "notify" payment request for order "#000001" using the "Offline" payment method + Given this payment method is not using Payum + And there is a "completed" "notify" payment request for order "#000001" using the "Offline" payment method When I call the payment request notify page for this payment request - Then a payment request with "notify" action and state "completed" should exists + Then a payment request with action "notify" for payment method "Offline" should have state "completed" + And the response status code should be 404 + + @ui + Scenario: Using Payum I want to send HTTP request to the payment request notify and succeeded + Given there is a "new" "notify" payment request for order "#000001" using the "Offline" payment method + When I call the payment request notify page for this payment request + Then a payment request with action "notify" for payment method "Offline" should have state "completed" + And the response status code should be 204 + And the response content should be empty + + @ui + Scenario: Using Payum I want to send HTTP request to the payment method notify and failed + Given there is a "completed" "notify" payment request for order "#000001" using the "Offline" payment method + When I call the payment request notify page for this payment request + Then a payment request with action "notify" for payment method "Offline" should have state "completed" And the response status code should be 404 diff --git a/src/Sylius/Behat/Context/Api/Shop/OrderContext.php b/src/Sylius/Behat/Context/Api/Shop/OrderContext.php index c5c2ce7a54..f4a1b854df 100644 --- a/src/Sylius/Behat/Context/Api/Shop/OrderContext.php +++ b/src/Sylius/Behat/Context/Api/Shop/OrderContext.php @@ -48,28 +48,9 @@ final readonly class OrderContext implements Context ) { } - /** - * @Given /^I am changing (this order)'s payment method$/ - */ - public function iWantToChangeThisOrdersPaymentMethod(OrderInterface $order): void - { - $request = $this->requestFactory->custom( - sprintf( - '%s/shop/account/orders/%s/payments/%s', - $this->apiUrlPrefix, - $order->getTokenValue(), - (string) $order->getPayments()->first()->getId(), - ), - HttpRequest::METHOD_PATCH, - [], - $this->shopClient->getToken(), - ); - - $this->sharedStorage->set('payment_method_patch_request', $request); - } - /** * @When I change my payment method to :paymentMethod + * @When I try to change my payment method to :paymentMethod */ public function iChangeMyPaymentMethodTo(PaymentMethodInterface $paymentMethod): void { @@ -92,18 +73,6 @@ final readonly class OrderContext implements Context $this->shopClient->executeCustomRequest($request); } - /** - * @When I try to change my payment method to :paymentMethod - */ - public function iTryToChangeMyPaymentMethodTo(PaymentMethodInterface $paymentMethod): void - { - $request = $this->sharedStorage->get('payment_method_patch_request'); - - $request->setContent(['paymentMethod' => $this->iriConverter->getIriFromResource($paymentMethod)]); - - $this->shopClient->executeCustomRequest($request); - } - /** * @When I view the summary of my order :order */ diff --git a/src/Sylius/Behat/Context/Api/Shop/PaymentRequestContext.php b/src/Sylius/Behat/Context/Api/Shop/PaymentRequestContext.php index 6daf30f66a..dbc8846c03 100644 --- a/src/Sylius/Behat/Context/Api/Shop/PaymentRequestContext.php +++ b/src/Sylius/Behat/Context/Api/Shop/PaymentRequestContext.php @@ -61,9 +61,9 @@ final readonly class PaymentRequestContext implements Context } /** - * @Then my payment request with action :action for payment method :paymentMethod should have state :state + * @Then a payment request with action :action for payment method :paymentMethod should have state :state */ - public function myPaymentRequestShouldBeCancelled(string $action, PaymentMethodInterface $paymentMethod, string $state): void + public function aPaymentRequestWithActionForPaymentMethodShouldHaveState(string $action, PaymentMethodInterface $paymentMethod, string $state): void { $request = $this->getRequestForPaymentRequestWithAction($action); Assert::notNull($request, sprintf('Payment request with action %s not found', $action)); diff --git a/src/Sylius/Behat/Context/Setup/PaymentContext.php b/src/Sylius/Behat/Context/Setup/PaymentContext.php index e5d3b91e73..b1c00d1f2a 100644 --- a/src/Sylius/Behat/Context/Setup/PaymentContext.php +++ b/src/Sylius/Behat/Context/Setup/PaymentContext.php @@ -102,6 +102,18 @@ final readonly class PaymentContext implements Context $this->paymentMethodManager->flush(); } + /** + * @Given /^(this payment method) is not using Payum$/ + */ + public function thisPaymentMethodIsNotUsingPayum(PaymentMethodInterface $paymentMethod): void + { + /** @var GatewayConfigInterface $gatewayConfig */ + $gatewayConfig = $paymentMethod->getGatewayConfig(); + $gatewayConfig->setUsePayum(false); + + $this->paymentMethodManager->flush(); + } + /** * @Given the payment method :paymentMethod is disabled * @Given /^(this payment method) (?:has been|is) disabled$/ diff --git a/src/Sylius/Behat/Context/Ui/Shop/AccountContext.php b/src/Sylius/Behat/Context/Ui/Shop/AccountContext.php index 5e989b758f..8a3c7d08a1 100644 --- a/src/Sylius/Behat/Context/Ui/Shop/AccountContext.php +++ b/src/Sylius/Behat/Context/Ui/Shop/AccountContext.php @@ -14,6 +14,7 @@ declare(strict_types=1); namespace Sylius\Behat\Context\Ui\Shop; use Behat\Behat\Context\Context; +use Behat\Mink\Exception\ElementNotFoundException; use FriendsOfBehat\PageObjectExtension\Page\UnexpectedPageException; use Sylius\Behat\NotificationType; use Sylius\Behat\Page\Shop\Account\ChangePasswordPageInterface; @@ -302,21 +303,22 @@ final readonly class AccountContext implements Context */ public function iChangeMyPaymentMethodTo(PaymentMethodInterface $paymentMethod): void { - /** @var OrderInterface $order */ - $order = $this->sharedStorage->get('order'); - - $this->orderIndexPage->changePaymentMethod($order); $this->orderShowPage->choosePaymentMethod($paymentMethod); $this->orderShowPage->pay(); } /** - * @Then I try to change my payment method to :paymentMethod + * @When I try to change my payment method to :paymentMethod */ public function iChoosePaymentMethod(PaymentMethodInterface $paymentMethod): void { - $this->orderShowPage->choosePaymentMethod($paymentMethod); - $this->orderShowPage->pay(); + try { + $this->orderShowPage->choosePaymentMethod($paymentMethod); + } catch (ElementNotFoundException) { + return; + } + + throw new \InvalidArgumentException('The payment method has been changed, but it should not be the case.'); } /** diff --git a/src/Sylius/Behat/Context/Ui/Shop/PaymentRequestContext.php b/src/Sylius/Behat/Context/Ui/Shop/PaymentRequestContext.php index ce8510d64e..9ff8c5ad5d 100644 --- a/src/Sylius/Behat/Context/Ui/Shop/PaymentRequestContext.php +++ b/src/Sylius/Behat/Context/Ui/Shop/PaymentRequestContext.php @@ -17,6 +17,7 @@ use Behat\Behat\Context\Context; use Doctrine\Persistence\ObjectManager; use Sylius\Behat\Page\Shop\PaymentRequest\PaymentMethodNotifyPageInterface; use Sylius\Behat\Page\Shop\PaymentRequest\PaymentRequestNotifyPage; +use Sylius\Component\Core\Model\PaymentMethodInterface; use Sylius\Component\Payment\Model\PaymentRequestInterface; use Sylius\Component\Payment\Repository\PaymentRequestRepositoryInterface; use Webmozart\Assert\Assert; @@ -63,15 +64,17 @@ final readonly class PaymentRequestContext implements Context } /** - * @Then /^a payment request with "([^"]*)" action and state "([^"]*)" should exists$/ + * @Then a payment request with action :action for payment method :paymentMethod should have state :state */ - public function aPaymentRequestWithActionAndStateCompletedShouldExists(string $action, string $state): void + public function aPaymentRequestWithActionForPaymentMethodShouldHaveState(string $action, PaymentMethodInterface $paymentMethod, string $state): void { $this->objectManager->clear(); // avoiding doctrine cache /** @var PaymentRequestInterface[] $paymentRequests */ $paymentRequests = $this->paymentRequestRepository->findBy( - ['action' => $action], + [ + 'action' => $action, + ], ['createdAt' => 'ASC'], 1, ); @@ -79,6 +82,7 @@ final readonly class PaymentRequestContext implements Context Assert::count($paymentRequests, 1); $paymentRequest = $paymentRequests[0]; Assert::notNull($paymentRequest); + Assert::eq($paymentRequest->getMethod()->getId(), $paymentMethod->getId()); Assert::eq($paymentRequest->getState(), $state); } diff --git a/src/Sylius/Behat/Page/Shop/Account/Order/IndexPageInterface.php b/src/Sylius/Behat/Page/Shop/Account/Order/IndexPageInterface.php index 93a3dd563b..a6389feb8c 100644 --- a/src/Sylius/Behat/Page/Shop/Account/Order/IndexPageInterface.php +++ b/src/Sylius/Behat/Page/Shop/Account/Order/IndexPageInterface.php @@ -20,7 +20,7 @@ interface IndexPageInterface extends SymfonyPageInterface { public function countOrders(): int; - public function changePaymentMethod(OrderInterface $order); + public function changePaymentMethod(OrderInterface $order): void; public function hasFlashMessage(string $message): bool; diff --git a/src/Sylius/Behat/Resources/config/suites/api/account/customer.yml b/src/Sylius/Behat/Resources/config/suites/api/account/customer.yml index cc93f728e5..6431669863 100644 --- a/src/Sylius/Behat/Resources/config/suites/api/account/customer.yml +++ b/src/Sylius/Behat/Resources/config/suites/api/account/customer.yml @@ -35,6 +35,7 @@ default: - sylius.behat.context.api.email - sylius.behat.context.api.shop.checkout + - sylius.behat.context.api.shop.checkout.order_details - sylius.behat.context.api.shop.customer - sylius.behat.context.api.shop.login - sylius.behat.context.api.shop.order diff --git a/src/Sylius/Behat/Resources/config/suites/ui/account/customer.yml b/src/Sylius/Behat/Resources/config/suites/ui/account/customer.yml index 9a86d36d1d..14b1872c99 100644 --- a/src/Sylius/Behat/Resources/config/suites/ui/account/customer.yml +++ b/src/Sylius/Behat/Resources/config/suites/ui/account/customer.yml @@ -44,6 +44,7 @@ default: - sylius.behat.context.ui.shop.checkout.complete - sylius.behat.context.ui.shop.checkout.payment - sylius.behat.context.ui.shop.checkout.shipping + - sylius.behat.context.ui.shop.checkout.order_details - sylius.behat.context.ui.shop.currency - sylius.behat.context.ui.shop.homepage - sylius.behat.context.ui.user diff --git a/src/Sylius/Behat/Resources/config/suites/ui/checkout/paying_for_order.yml b/src/Sylius/Behat/Resources/config/suites/ui/checkout/paying_for_order.yml index 7beca5480d..87e8782637 100644 --- a/src/Sylius/Behat/Resources/config/suites/ui/checkout/paying_for_order.yml +++ b/src/Sylius/Behat/Resources/config/suites/ui/checkout/paying_for_order.yml @@ -49,6 +49,7 @@ default: - sylius.behat.context.ui.shop.checkout.payment - sylius.behat.context.ui.shop.checkout.shipping - sylius.behat.context.ui.shop.checkout.thank_you + - sylius.behat.context.ui.shop.payment_request filters: diff --git a/src/Sylius/Bundle/PaymentBundle/Command/Offline/StatusPaymentRequest.php b/src/Sylius/Bundle/PaymentBundle/Command/Offline/StatusPaymentRequest.php new file mode 100644 index 0000000000..38be694220 --- /dev/null +++ b/src/Sylius/Bundle/PaymentBundle/Command/Offline/StatusPaymentRequest.php @@ -0,0 +1,27 @@ +paymentRequestProvider->provide($statusPaymentRequest); + + $this->stateMachine->apply( + $paymentRequest, + PaymentRequestTransitions::GRAPH, + PaymentRequestTransitions::TRANSITION_COMPLETE, + ); + } +} diff --git a/src/Sylius/Bundle/PaymentBundle/CommandProvider/Offline/StatusPaymentRequestCommandProvider.php b/src/Sylius/Bundle/PaymentBundle/CommandProvider/Offline/StatusPaymentRequestCommandProvider.php new file mode 100644 index 0000000000..c5d42445cd --- /dev/null +++ b/src/Sylius/Bundle/PaymentBundle/CommandProvider/Offline/StatusPaymentRequestCommandProvider.php @@ -0,0 +1,32 @@ +getAction() === PaymentRequestInterface::ACTION_STATUS; + } + + public function provide(PaymentRequestInterface $paymentRequest): object + { + return new StatusPaymentRequest($paymentRequest->getId()); + } +} diff --git a/src/Sylius/Bundle/PaymentBundle/Resources/config/services/command_handler.xml b/src/Sylius/Bundle/PaymentBundle/Resources/config/services/command_handler.xml index e69dc8c196..e86c15fb9c 100644 --- a/src/Sylius/Bundle/PaymentBundle/Resources/config/services/command_handler.xml +++ b/src/Sylius/Bundle/PaymentBundle/Resources/config/services/command_handler.xml @@ -22,5 +22,10 @@ + + + + + diff --git a/src/Sylius/Bundle/PaymentBundle/Resources/config/services/command_provider.xml b/src/Sylius/Bundle/PaymentBundle/Resources/config/services/command_provider.xml index d87a2151fe..232e371f34 100644 --- a/src/Sylius/Bundle/PaymentBundle/Resources/config/services/command_provider.xml +++ b/src/Sylius/Bundle/PaymentBundle/Resources/config/services/command_provider.xml @@ -32,5 +32,9 @@ + + + + diff --git a/src/Sylius/Bundle/PayumBundle/PaymentRequest/CommandProvider/PayumActionsCommandProvider.php b/src/Sylius/Bundle/PayumBundle/PaymentRequest/CommandProvider/PayumActionsCommandProvider.php new file mode 100644 index 0000000000..8aed986df2 --- /dev/null +++ b/src/Sylius/Bundle/PayumBundle/PaymentRequest/CommandProvider/PayumActionsCommandProvider.php @@ -0,0 +1,46 @@ + $locator */ + public function __construct( + private AbstractServiceCommandProvider $decoratedActionsCommandProvider, + protected ServiceProviderInterface $locator, + ) { + } + + protected function getCommandProviderIndex(PaymentRequestInterface $paymentRequest): string + { + return $paymentRequest->getAction(); + } + + public function provide(PaymentRequestInterface $paymentRequest): object + { + /** @var GatewayConfigInterface|null $gatewayConfig */ + $gatewayConfig = $paymentRequest->getMethod()->getGatewayConfig(); + + return $gatewayConfig?->getUsePayum() ?? true + ? parent::provide($paymentRequest) + : $this->decoratedActionsCommandProvider->provide($paymentRequest); + } +} diff --git a/src/Sylius/Bundle/PayumBundle/Resources/config/services/payment_request/command_provider.xml b/src/Sylius/Bundle/PayumBundle/Resources/config/services/payment_request/command_provider.xml index e1fbd74edf..03f683cc93 100644 --- a/src/Sylius/Bundle/PayumBundle/Resources/config/services/payment_request/command_provider.xml +++ b/src/Sylius/Bundle/PayumBundle/Resources/config/services/payment_request/command_provider.xml @@ -17,9 +17,10 @@ xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd" > - + + - diff --git a/src/Sylius/Bundle/ShopBundle/Resources/config/services/order_pay/controllers.xml b/src/Sylius/Bundle/ShopBundle/Resources/config/services/order_pay/controllers.xml index 60987b4510..b415f5540d 100644 --- a/src/Sylius/Bundle/ShopBundle/Resources/config/services/order_pay/controllers.xml +++ b/src/Sylius/Bundle/ShopBundle/Resources/config/services/order_pay/controllers.xml @@ -22,8 +22,9 @@ - + + diff --git a/src/Sylius/Bundle/UserBundle/Resources/config/app/config.yml b/src/Sylius/Bundle/UserBundle/Resources/config/app/config.yml index 722bc48b69..da272e688c 100644 --- a/src/Sylius/Bundle/UserBundle/Resources/config/app/config.yml +++ b/src/Sylius/Bundle/UserBundle/Resources/config/app/config.yml @@ -14,8 +14,3 @@ when@test_cached: security: password_hashers: plaintext: plaintext - -when@test_cached_payum: - security: - password_hashers: - plaintext: plaintext diff --git a/tests/Api/DataFixtures/ORM/gateway_config_payment_request.yaml b/tests/Api/DataFixtures/ORM/gateway_config_payment_request.yaml new file mode 100644 index 0000000000..48164b8d79 --- /dev/null +++ b/tests/Api/DataFixtures/ORM/gateway_config_payment_request.yaml @@ -0,0 +1,6 @@ +Sylius\Bundle\PayumBundle\Model\GatewayConfig: + gateway_offline: + gatewayName: 'Offline' + factoryName: 'offline' + usePayum: false + config: [] diff --git a/tests/Api/Shop/CustomersTest.php b/tests/Api/Shop/CustomersTest.php index cea3e58974..5b89db10d7 100644 --- a/tests/Api/Shop/CustomersTest.php +++ b/tests/Api/Shop/CustomersTest.php @@ -88,7 +88,6 @@ final class CustomersTest extends JsonApiTestCase $this->assertResponseCode($this->client->getResponse(), Response::HTTP_NOT_FOUND); } - /** @test */ public function it_registers_a_new_customer(): void { diff --git a/tests/Api/Shop/PaymentRequestsTest.php b/tests/Api/Shop/PaymentRequestsTest.php index 2500b42bb8..318ca7e42f 100644 --- a/tests/Api/Shop/PaymentRequestsTest.php +++ b/tests/Api/Shop/PaymentRequestsTest.php @@ -66,7 +66,7 @@ final class PaymentRequestsTest extends JsonApiTestCase */ public function it_creates_a_payment_request(array $fixturesPaths, string $responsePath): void { - $this->loadFixturesFromFiles($fixturesPaths); + $fixtures = $this->loadFixturesFromFiles($fixturesPaths); $tokenValue = 'nAWw2jewpA'; $order = $this->placeOrder($tokenValue, 'oliver@doe.com'); @@ -262,25 +262,20 @@ final class PaymentRequestsTest extends JsonApiTestCase public function createPaymentRequestProvider(): iterable { - $environment = getenv('APP_ENV'); + yield 'Payment request' => [ + [ + 'authentication/shop_user.yaml', + 'channel/channel.yaml', + 'cart.yaml', + 'country.yaml', + 'shipping_method.yaml', + 'gateway_config_payment_request.yaml', + 'payment_method.yaml', + ], + 'shop/payment_request/post_payment_request', + ]; - if ($environment === 'test_cached_payum') { - yield [ - [ - 'authentication/shop_user.yaml', - 'channel/channel.yaml', - 'cart.yaml', - 'country.yaml', - 'shipping_method.yaml', - 'payment_method.yaml', - ], - 'shop/payment_request/post_payment_request_payum', - ]; - - return; - } - - yield [ + yield 'Payum' => [ [ 'authentication/shop_user.yaml', 'channel/channel.yaml', @@ -289,38 +284,33 @@ final class PaymentRequestsTest extends JsonApiTestCase 'shipping_method.yaml', 'payment_method.yaml', ], - 'shop/payment_request/post_payment_request', + 'shop/payment_request/post_payment_request_payum', ]; } - public function updatePaymentRequestProvider(): iterable + public static function updatePaymentRequestProvider(): iterable { - $environment = getenv('APP_ENV'); - - if ($environment === 'test_cached_payum') { - yield [ - [ - 'authentication/shop_user.yaml', - 'channel/channel.yaml', - 'payment_method.yaml', - 'payment_request/payment_request_payum.yaml', - 'payment_request/order_with_customer.yaml', - ], - 'shop/payment_request/put_payment_request_payum', - ]; - - return; - } - - yield [ + yield 'Payment Request' => [ [ 'authentication/shop_user.yaml', 'channel/channel.yaml', + 'gateway_config_payment_request.yaml', 'payment_method.yaml', 'payment_request/payment_request.yaml', 'payment_request/order_with_customer.yaml', ], 'shop/payment_request/put_payment_request', ]; + + yield 'Payum' => [ + [ + 'authentication/shop_user.yaml', + 'channel/channel.yaml', + 'payment_method.yaml', + 'payment_request/payment_request_payum.yaml', + 'payment_request/order_with_customer.yaml', + ], + 'shop/payment_request/put_payment_request_payum', + ]; } }