Skip to content

Commit

Permalink
Remove cache services (+config) & unused classes/services (#194)
Browse files Browse the repository at this point in the history
  • Loading branch information
stefandoorn authored Jun 28, 2023
1 parent 015b755 commit f851ff8
Show file tree
Hide file tree
Showing 20 changed files with 18 additions and 462 deletions.
2 changes: 2 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ Checkout settings have been removed from the config.

`CheckoutStep` constants have been moved to the `CheckoutStepInterface`.

Several services/classes have been removed (because they became unused), including the cache services including their configs.

Upgrade 1.2.0 -> 2.0.0
----------------------

Expand Down
19 changes: 4 additions & 15 deletions src/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace StefanDoorn\SyliusGtmEnhancedEcommercePlugin\DependencyInjection;

use StefanDoorn\SyliusGtmEnhancedEcommercePlugin\Object\ProductDetailInterface;
use StefanDoorn\SyliusGtmEnhancedEcommercePlugin\Helper\ProductIdentifierHelper;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;

Expand All @@ -18,9 +18,9 @@ public function getConfigTreeBuilder(): TreeBuilder
$rootNode
->children()
->enumNode('product_identifier')
->info(\sprintf('Choose which product identifier you want to use between %s and %s', ProductDetailInterface::ID_IDENTIFIER, ProductDetailInterface::CODE_IDENTIFIER))
->values(ProductDetailInterface::IDENTIFIERS)
->defaultValue(ProductDetailInterface::ID_IDENTIFIER)
->info(\sprintf('Choose which product identifier you want to use between %s and %s', ProductIdentifierHelper::ID_IDENTIFIER, ProductIdentifierHelper::CODE_IDENTIFIER))
->values(ProductIdentifierHelper::IDENTIFIERS)
->defaultValue(ProductIdentifierHelper::ID_IDENTIFIER)
->end()
->arrayNode('features')
->addDefaultsIfNotSet()
Expand All @@ -36,17 +36,6 @@ public function getConfigTreeBuilder(): TreeBuilder
->booleanNode('view_item_list')->defaultTrue()->end()
->end()
->end()
->arrayNode('cache_resolvers')
->canBeEnabled()
->children()
->arrayNode('ttl')
->addDefaultsIfNotSet()
->children()
->integerNode('product_detail_impressions')->defaultValue(3600)->end()
->end()
->end()
->end()
->end()
->end()
;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,5 @@ public function load(array $configs, ContainerBuilder $container): void
$loader->load(\sprintf('features/%s.yml', $feature));
}
}

if ($config['cache_resolvers']['enabled'] === true) {
$loader->load('cache_services.yml');

foreach ($config['cache_resolvers']['ttl'] as $feature => $ttl) {
$parameter = \sprintf('sylius_gtm_enhanced_ecommerce.cache_resolver.%s', $feature);
$container->setParameter($parameter, $ttl);
}
}
}
}
11 changes: 8 additions & 3 deletions src/Helper/ProductIdentifierHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,16 @@

namespace StefanDoorn\SyliusGtmEnhancedEcommercePlugin\Helper;

use StefanDoorn\SyliusGtmEnhancedEcommercePlugin\Object\ProductDetailInterface;
use Sylius\Component\Core\Model\ProductInterface;

final class ProductIdentifierHelper
{
public const ID_IDENTIFIER = 'id';

public const CODE_IDENTIFIER = 'code';

public const IDENTIFIERS = [self::ID_IDENTIFIER, self::CODE_IDENTIFIER];

private string $productIdentifier;

public function __construct(string $productIdentifier)
Expand All @@ -19,9 +24,9 @@ public function __construct(string $productIdentifier)
public function getProductIdentifier(ProductInterface $product): string
{
switch ($this->productIdentifier) {
case ProductDetailInterface::ID_IDENTIFIER:
case self::ID_IDENTIFIER:
return (string) $product->getId();
case ProductDetailInterface::CODE_IDENTIFIER:
case self::CODE_IDENTIFIER:
return $product->getCode();
}

Expand Down
16 changes: 0 additions & 16 deletions src/Object/Factory/ProductDetailFactory.php

This file was deleted.

12 changes: 0 additions & 12 deletions src/Object/Factory/ProductDetailFactoryInterface.php

This file was deleted.

16 changes: 0 additions & 16 deletions src/Object/Factory/ProductDetailImpressionFactory.php

This file was deleted.

12 changes: 0 additions & 12 deletions src/Object/Factory/ProductDetailImpressionFactoryInterface.php

This file was deleted.

79 changes: 0 additions & 79 deletions src/Object/ProductDetail.php

This file was deleted.

23 changes: 0 additions & 23 deletions src/Object/ProductDetailImpression.php

This file was deleted.

12 changes: 0 additions & 12 deletions src/Object/ProductDetailImpressionInterface.php

This file was deleted.

36 changes: 0 additions & 36 deletions src/Object/ProductDetailInterface.php

This file was deleted.

65 changes: 0 additions & 65 deletions src/Resolver/Cache/ProductDetailImpressionCachedDataResolver.php

This file was deleted.

Loading

0 comments on commit f851ff8

Please sign in to comment.