Skip to content

Commit b8da614

Browse files
committed
Remove the cached provider functionality
1 parent 43146ee commit b8da614

File tree

5 files changed

+0
-176
lines changed

5 files changed

+0
-176
lines changed

src/DependencyInjection/Compiler/RegisterProvidersPass.php

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
namespace Setono\SyliusPickupPointPlugin\DependencyInjection\Compiler;
66

77
use InvalidArgumentException;
8-
use Setono\SyliusPickupPointPlugin\Provider\CachedProvider;
98
use Setono\SyliusPickupPointPlugin\Provider\LocalProvider;
109
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
1110
use Symfony\Component\DependencyInjection\ContainerBuilder;
@@ -21,7 +20,6 @@ public function process(ContainerBuilder $container): void
2120
}
2221

2322
$registry = $container->getDefinition('setono_sylius_pickup_point.registry.provider');
24-
$cacheEnabled = $container->getParameter('setono_sylius_pickup_point.cache.enabled') === true;
2523
$localEnabled = $container->getParameter('setono_sylius_pickup_point.local') === true;
2624

2725
$typeToLabelMap = [];
@@ -33,18 +31,6 @@ public function process(ContainerBuilder $container): void
3331

3432
$typeToLabelMap[$attributes['code']] = $attributes['label'];
3533

36-
if ($cacheEnabled) {
37-
$decoratedId = $id;
38-
$id .= '.cached'; // overwrite the id
39-
$cachedDefinition = new Definition(CachedProvider::class, [
40-
new Reference('setono_sylius_pickup_point.cache'),
41-
new Reference($id . '.inner'),
42-
]);
43-
$cachedDefinition->setDecoratedService($decoratedId, null, 256);
44-
45-
$container->setDefinition($id, $cachedDefinition);
46-
}
47-
4834
if ($localEnabled) {
4935
$decoratedId = $id;
5036
$id .= '.local'; // overwrite the id

src/DependencyInjection/Configuration.php

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,6 @@ public function getConfigTreeBuilder(): TreeBuilder
2929
->addDefaultsIfNotSet()
3030
->children()
3131
->scalarNode('driver')->defaultValue(SyliusResourceBundle::DRIVER_DOCTRINE_ORM)->end()
32-
->arrayNode('cache')
33-
->addDefaultsIfNotSet()
34-
->children()
35-
->booleanNode('enabled')
36-
->defaultFalse()
37-
->end()
38-
->scalarNode('pool')
39-
->defaultNull()
40-
->end()
41-
->end()
42-
->end()
4332
->booleanNode('local')
4433
->defaultValue(true)
4534
->info('Whether to use the local database when timeouts occur in third party HTTP calls. Remember to run the setono-sylius-pickup-point:load-pickup-points command periodically to populate the local database with pickup points')

src/DependencyInjection/SetonoSyliusPickupPointExtension.php

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
use LogicException;
88
use Sylius\Bundle\ResourceBundle\DependencyInjection\Extension\AbstractResourceExtension;
9-
use Symfony\Component\Cache\Adapter\AdapterInterface;
109
use Symfony\Component\Config\FileLocator;
1110
use Symfony\Component\DependencyInjection\ContainerBuilder;
1211
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
@@ -28,21 +27,6 @@ public function load(array $configs, ContainerBuilder $container): void
2827
$bundles = $container->hasParameter('kernel.bundles') ? $container->getParameter('kernel.bundles') : [];
2928
Assert::isArray($bundles);
3029

31-
$cacheEnabled = $config['cache']['enabled'];
32-
if ($cacheEnabled) {
33-
if (!interface_exists(AdapterInterface::class)) {
34-
throw new LogicException('Using cache is only supported when symfony/cache is installed.');
35-
}
36-
37-
if (null === $config['cache']['pool']) {
38-
throw new LogicException('You should specify pool in order to use cache for pickup point providers.');
39-
}
40-
41-
$container->setAlias('setono_sylius_pickup_point.cache', $config['cache']['pool']);
42-
}
43-
44-
$container->setParameter('setono_sylius_pickup_point.cache.enabled', $cacheEnabled);
45-
4630
if ($config['providers']['faker']) {
4731
if ('prod' === $container->getParameter('kernel.environment')) {
4832
throw new LogicException("You can't use faker provider in production environment.");

src/Provider/CachedProvider.php

Lines changed: 0 additions & 132 deletions
This file was deleted.

tests/Application/config/packages/setono_sylius_pickup_point.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@ framework:
99
adapter: cache.app
1010

1111
setono_sylius_pickup_point:
12-
cache:
13-
enabled: true
14-
pool: setono_sylius_pickup_point.provider_cache_pool
1512
local: true
1613
providers:
1714
faker: true

0 commit comments

Comments
 (0)