Skip to content

Commit

Permalink
minor #14969 [DX] Removed obsolete templating helper (NoResponseMate)
Browse files Browse the repository at this point in the history
This PR was merged into the 1.13 branch.

Discussion
----------

| Q               | A                                                            |
|-----------------|--------------------------------------------------------------|
| Branch?         | 1.13 |
| Bug fix?        | no                                                       |
| New feature?    | no                                                       |
| BC breaks?      | no                                                       |
| Deprecations?   | no |
| Related tickets | followup #14885                      |
| License         | MIT                                                          |

Commits
-------

1fd6cc0 [DX] Removed obsolete templating helper
  • Loading branch information
GSadee committed Apr 28, 2023
2 parents eceed54 + 1fd6cc0 commit 907329e
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 50 deletions.
2 changes: 1 addition & 1 deletion UPGRADE-1.13.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
as such the following services were deprecated, please use their new counterpart.
* instead of `Sylius\Component\Core\Provider\ProductVariantsPricesProviderInterface` use `Sylius\Component\Core\Provider\ProductVariantMap\ProductVariantsMapProviderInterface`
* instead of `Sylius\Component\Core\Provider\ProductVariantsPricesProvider` use `Sylius\Component\Core\Provider\ProductVariantMap\ProductVariantsPricesMapProvider`
* instead of `Sylius\Bundle\CoreBundle\Templating\Helper\ProductVariantsPricesHelper` use `Sylius\Bundle\CoreBundle\Templating\Helper\ProductVariantsMapHelper`
* instead of `Sylius\Bundle\CoreBundle\Templating\Helper\ProductVariantsPricesHelper` use `Sylius\Component\Core\Provider\ProductVariantMap\ProductVariantsPricesMapProvider`
* instead of `Sylius\Bundle\CoreBundle\Twig\ProductVariantsPricesExtension` use `Sylius\Bundle\CoreBundle\Twig\ProductVariantsMapExtension`

Subsequently, the `sylius_product_variant_prices` twig function is deprecated, use `sylius_product_variants_map` instead.
Expand Down
2 changes: 1 addition & 1 deletion src/Sylius/Bundle/CoreBundle/Resources/config/services.xml
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@
</service>

<service id="Sylius\Bundle\CoreBundle\Twig\ProductVariantsMapExtension">
<argument type="service" id="Sylius\Bundle\CoreBundle\Templating\Helper\ProductVariantsMapHelper" />
<argument type="service" id="Sylius\Component\Core\Provider\ProductVariantMap\ProductVariantsMapProviderInterface" />
<tag name="twig.extension" />
</service>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"
>
<services>
<service id="Sylius\Component\Core\Provider\ProductVariantMap\ProductVariantsMapProvider">
<service
id="Sylius\Component\Core\Provider\ProductVariantMap\ProductVariantsMapProviderInterface"
class="Sylius\Component\Core\Provider\ProductVariantMap\ProductVariantsMapProvider"
>
<argument type="tagged_iterator" tag="sylius.product_variant_data_map_provider" />
</service>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,6 @@
<tag name="templating.helper" alias="sylius_product_variants_prices" />
</service>

<service id="Sylius\Bundle\CoreBundle\Templating\Helper\ProductVariantsMapHelper">
<argument type="service" id="Sylius\Component\Core\Provider\ProductVariantMap\ProductVariantsMapProvider" />
<tag name="templating.helper" alias="sylius_product_variants_map" />
</service>

<service id="sylius.templating.helper.price" class="Sylius\Bundle\CoreBundle\Templating\Helper\PriceHelper" lazy="true">
<argument type="service" id="sylius.calculator.product_variant_price" />
<tag name="templating.helper" alias="sylius_calculate_price" />
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@

use Sylius\Component\Core\Model\ChannelInterface;
use Sylius\Component\Core\Model\ProductInterface;
use Sylius\Component\Core\Provider\ProductVariantMap\ProductVariantsMapProvider;
use Sylius\Component\Core\Provider\ProductVariantsPricesProviderInterface;
use Symfony\Component\Templating\Helper\Helper;

/** @deprecated since 1.13 and will be removed in Sylius 2.0. Use {@see ProductVariantsMapHelper} instead. */
/** @deprecated since 1.13 and will be removed in Sylius 2.0. Use {@see ProductVariantsMapProvider} instead. */
class ProductVariantsPricesHelper extends Helper
{
public function __construct(private ProductVariantsPricesProviderInterface $productVariantsPricesProvider)
Expand All @@ -29,7 +30,7 @@ public function __construct(private ProductVariantsPricesProviderInterface $prod
sprintf(
'The "%s" class is deprecated since Sylius 1.13 and will be removed in 2.0. Use "%s" instead.',
self::class,
ProductVariantsMapHelper::class,
ProductVariantsMapProvider::class,
),
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,20 @@

namespace Sylius\Bundle\CoreBundle\Twig;

use Sylius\Bundle\CoreBundle\Templating\Helper\ProductVariantsMapHelper;
use Sylius\Component\Core\Provider\ProductVariantMap\ProductVariantsMapProviderInterface;
use Twig\Extension\AbstractExtension;
use Twig\TwigFunction;

final class ProductVariantsMapExtension extends AbstractExtension
{
public function __construct(private ProductVariantsMapHelper $productVariantsMapHelper)
public function __construct(private ProductVariantsMapProviderInterface $productVariantsMapProvider)
{
}

public function getFunctions(): array
{
return [
new TwigFunction('sylius_product_variants_map', [$this->productVariantsMapHelper, 'getMap']),
new TwigFunction('sylius_product_variants_map', [$this->productVariantsMapProvider, 'provide']),
];
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
use Sylius\Component\Core\Model\ProductInterface;
use Sylius\Component\Core\Provider\ProductVariantMap\ProductVariantsMapProviderInterface;

trigger_deprecation('sylius/user', '1.12', 'The "%s" class is deprecated, use "%s" instead.', ProductVariantsPricesProviderInterface::class, ProductVariantsMapProviderInterface::class);
trigger_deprecation('sylius/core', '1.13', 'The "%s" class is deprecated, use "%s" instead.', ProductVariantsPricesProviderInterface::class, ProductVariantsMapProviderInterface::class);

/** @deprecated since 1.13 and will be removed in Sylius 2.0. Use {@see ProductVariantsMapProviderInterface} instead. */
interface ProductVariantsPricesProviderInterface
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ function it_implements_product_variants_map_provider_interface(): void
$this->shouldImplement(ProductVariantsMapProviderInterface::class);
}

function it_provider_data_for_all_products_enabled_variants(
function it_provides_data_for_all_products_enabled_variants(
ProductVariantMapProviderInterface $firstProvider,
ProductVariantMapProviderInterface $secondProvider,
ProductVariantMapProviderInterface $thirdProvider,
Expand Down

0 comments on commit 907329e

Please sign in to comment.