6 KiB
UPGRADE FROM 2.2 TO 2.3
Configuration
-
The default value of
sylius_core.order_by_identifierhas been changed fromtruetofalse. (#18956)The
OrderByIdentifierSqlWalkeris no longer enabled by default. If your application relies on ordering by identifier, enable it explicitly in your configuration:sylius_core: order_by_identifier: true
Dependencies
-
The
behat/transliteratorpackage has been deprecated and will be removed in Sylius 3.0.Slug generation now primarily uses
symfony/string(Symfony\Component\String\Slugger\SluggerInterface). When no$sluggeris injected, the system falls back toBehat\Transliterator\Transliterator, but this fallback behavior is deprecated and will be removed in Sylius 3.0.The following classes have been updated — if you have extended or decorated them, update your constructor accordingly:
-
Sylius\Component\Product\Generator\SlugGenerator:-public function __construct() +public function __construct(private ?SluggerInterface $slugger)Deprecated: Passing
nullas$slugger(or omitting it) is deprecated since Sylius 2.3. Whennullis passed, the generator falls back toBehat\Transliterator\Transliterator. Both the nullable argument and thebehat/transliteratorfallback will be removed in Sylius 3.0. -
Sylius\Component\Taxonomy\Generator\TaxonSlugGenerator:-public function __construct() +public function __construct(private ?SluggerInterface $slugger)Deprecated: Same as above.
-
Sylius\Bundle\AdminBundle\Generator\TaxonSlugGenerator:public function __construct( private BaseTaxonSlugGeneratorInterface $slugGenerator, + private ?SluggerInterface $slugger, )Deprecated: Same as above.
The
StringInflector::nameToSlug()method has been deprecated and will be removed in Sylius 3.0. -
-
The
knplabs/gaufretteandknplabs/knp-gaufrette-bundlepackages have been removed.The Gaufrette integration has been unusable as a filesystem adapter. Since Sylius 2.0 the default filesystem adapter uses Flysystem instead.
If your application depends on the Gaufrette packages directly, require them explicitly in your
composer.json.
Promotion
-
Promotion rules and actions can now be configured independently per channel. The feature is additive — existing promotions keep working unchanged — but two core services had their class swapped by
OverridePromotionServicesPass. The service ids, the implemented interfaces and the constructor arguments are unchanged:Service id Old class New class sylius.checker.promotion.rules_eligibilitySylius\Component\Promotion\Checker\Eligibility\PromotionRulesEligibilityCheckerSylius\Component\Core\Promotion\Checker\Eligibility\ChannelAwarePromotionRulesEligibilityCheckersylius.action.applicator.promotionSylius\Component\Promotion\Action\PromotionApplicatorSylius\Component\Core\Promotion\Action\ChannelAwarePromotionApplicatorIf you decorate these services, no change is required. If you replaced their definition or relied on the concrete class (e.g.
instanceof PromotionApplicator), update your code to the new classes or to theSylius\Component\Promotion\Action\PromotionApplicatorInterface/Sylius\Component\Promotion\Checker\Eligibility\PromotionEligibilityCheckerInterfaceabstractions. -
A reserved configuration key
_excludedChannels(Sylius\Component\Core\Promotion\ChannelAwareConfigurationInterface::EXCLUDED_CHANNELS_CONFIGURATION_KEY) may now be present in a promotion rule's or action'sconfigurationarray. It holds the channel codes for which the rule/action is skipped and is stripped before the configuration reaches the rule checker / action command.If you read a promotion rule/action
configurationdirectly (custom rule checkers, action commands, serializers, exports), ignore this key — it is not part of a rule/action's own configuration. -
New
*_per_channelpromotion rule and action types were added (e.g.cart_quantity_per_channel,customer_group_per_channel,order_percentage_discount_per_channel). Their configuration is keyed by channel code, so each channel can have its own values. These are additional types and do not replace the existing ones.
Deprecations
-
Passing a
Sylius\Component\Core\Calculator\ProductVariantPricesCalculatorInterfacedirectly to the following catalog-facing classes is deprecated since Sylius 2.3. ImplementSylius\Component\Core\Calculator\CatalogPricesCalculatorInterfaceinstead, which extendsProductVariantPricesCalculatorInterfacewith no additional methods. It will be required in Sylius 3.0.Affected classes:
Sylius\Bundle\CoreBundle\Twig\PriceExtensionSylius\Bundle\ApiBundle\Serializer\Normalizer\ProductVariantNormalizerSylius\Bundle\ShopBundle\Twig\Component\Product\PriceComponentSylius\Bundle\ShopBundle\Twig\Component\Product\CardComponentSylius\Component\Core\Provider\ProductVariantMap\ProductVariantPriceMapProviderSylius\Component\Core\Provider\ProductVariantMap\ProductVariantOriginalPriceMapProviderSylius\Component\Core\Provider\ProductVariantMap\ProductVariantLowestPriceMapProvider
If you have a custom calculator used for catalog display, make it implement
CatalogPricesCalculatorInterface:use Sylius\Component\Core\Calculator\CatalogPricesCalculatorInterface; final class MyCustomCatalogPriceCalculator implements CatalogPricesCalculatorInterface { // ... }This allows you to decorate catalog display pricing independently from cart/order pricing (
sylius.order_processing.order_prices_recalculator,sylius.filter.promotion.price_range), which remain onProductVariantPricesCalculatorInterface.