5.6 KiB
UPGRADE FROM v1.12.X TO v1.13.0
-
Starting with Sylius 1.13, the
SyliusPriceHistoryPluginis included. If you are currently using the plugin in your project, we recommend following the upgrade guide located here. -
The
Sylius\Bundle\CoreBundle\CatalogPromotion\Command\RemoveInactiveCatalogPromotioncommand and its handlerSylius\Bundle\CoreBundle\CatalogPromotion\CommandHandler\RemoveInactiveCatalogPromotionHandlerhave been deprecated. UseSylius\Bundle\CoreBundle\CatalogPromotion\Command\RemoveCatalogPromotioncommand instead. -
Passing
Symfony\Component\Messenger\MessageBusInterfacetoSylius\Bundle\CoreBundle\CatalogPromotion\Processor\CatalogPromotionRemovalProcessoras a second and third argument is deprecated. -
Not passing
Sylius\Bundle\CoreBundle\CatalogPromotion\Announcer\CatalogPromotionRemovalAnnouncerInterfacetoSylius\Bundle\CoreBundle\CatalogPromotion\Processor\CatalogPromotionRemovalProcessoras a second argument is deprecated. -
Not passing
Doctrine\Persistence\ObjectManagertoSylius\Component\Core\Updater\UnpaidOrdersStateUpdateras a fifth argument is deprecated. -
To allow to autoconfigure order processors and cart context and define a priority for them in
1.13we have introducedSylius\Bundle\OrderBundle\Attribute\AsCartContextandSylius\Bundle\OrderBundle\Attribute\AsOrderProcessorattributes. By default, Sylius still configures them using interfaces, but this way you cannot define a priority. If you want to define a priority, you need to set the following configuration in your_sylius.yamlfile:sylius_core: autoconfigure_with_attributes: trueand use one of the new attributes accordingly to a type of your class, e.g.:
<?php declare(strict_types=1); namespace App\OrderProcessor; use Sylius\Bundle\OrderBundle\Attribute\AsOrderProcessor; use Sylius\Component\Order\Model\OrderInterface; use Sylius\Component\Order\Processor\OrderProcessorInterface; #[AsOrderProcessor(priority: 10)] //priority is optional //#[AsOrderProcessor] can be used as well final class OrderProcessorWithAttributeStub implements OrderProcessorInterface { public function process(OrderInterface $order): void { } } -
Not passing
Sylius\Component\Core\Checker\ProductVariantLowestPriceDisplayCheckerInterfacetoSylius\Component\Core\Calculator\ProductVariantPriceCalculatoras a first argument is deprecated. -
Not passing an instance of
Symfony\Component\PropertyAccess\PropertyAccessorInterfacetoSylius\Bundle\CoreBundle\Validator\Constraints\HasEnabledEntityValidatoras the second argument is deprecated. -
Class
\Sylius\Bundle\ShopBundle\Calculator\OrderItemsSubtotalCalculatorhas been deprecated. Order items subtotal calculation is now available on the Order model\Sylius\Component\Core\Model\Order::getItemsSubtotal. -
The way of getting variants prices based on options has been changed, as such the following services were deprecated, please use their new counterpart.
- instead of
Sylius\Component\Core\Provider\ProductVariantsPricesProviderInterfaceuseSylius\Component\Core\Provider\ProductVariantMap\ProductVariantsMapProviderInterface - instead of
Sylius\Component\Core\Provider\ProductVariantsPricesProvideruseSylius\Component\Core\Provider\ProductVariantMap\ProductVariantsPricesMapProvider - instead of
Sylius\Bundle\CoreBundle\Templating\Helper\ProductVariantsPricesHelperuseSylius\Bundle\CoreBundle\Templating\Helper\ProductVariantsMapHelper - instead of
Sylius\Bundle\CoreBundle\Twig\ProductVariantsPricesExtensionuseSylius\Bundle\CoreBundle\Twig\ProductVariantsMapExtension
Subsequently, the
sylius_product_variant_pricestwig function is deprecated, usesylius_product_variants_mapinstead.To add more data per variant create a service implementing the
Sylius\Component\Core\Provider\ProductVariantMap\ProductVariantMapProviderInterfaceand tag it withsylius.product_variant_data_map_provider. - instead of
-
Using Guzzle 6 has been deprecated in favor of Symfony HTTP Client. If you want to still use Guzzle 6 or Guzzle 7, you need to install
composer require php-http/guzzle6-adapterorcomposer require php-http/guzzle7-adapterdepending on your Guzzle version. Subsequently, you need to register the adapter as aPsr\Http\Client\ClientInterfaceservice as the following:services: Psr\Http\Client\ClientInterface: class: Http\Adapter\Guzzle7\Client # for Guzzle 6 use Http\Adapter\Guzzle6\Client instead -
The constructor of
Sylius\Bundle\AdminBundle\Controller\NotificationControllerhas been changed:public function __construct( - private ClientInterface $client, - private MessageFactory $messageFactory, + private ClientInterface|DeprecatedClientInterface $client, + private RequestFactoryInterface|MessageFactory $requestFactory, private string $hubUri, private string $environment, + private ?StreamFactoryInterface $streamFactory = null, ) { ... } -
The
sylius.http_message_factoryservice has been deprecated. UsePsr\Http\Message\RequestFactoryInterfaceinstead. -
The
sylius.http_clienthas become an alias topsr18.http_clientservice. -
The
sylius.payum.http_clienthas become a service ID of newly createdSylius\Bundle\PayumBundle\HttpClient\HttpClient.