Skip to content

Commit 3f31236

Browse files
committed
Removed router.yml
1 parent 1f423a0 commit 3f31236

File tree

6 files changed

+14
-23
lines changed

6 files changed

+14
-23
lines changed

src/Cache/FixedTaggingCachePool.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
use Psr\Cache\CacheItemPoolInterface;
1717

1818
/**
19-
* This class is a decorator for a TaggablePoolInterface. It tags everything with 'doctrine'.
19+
* This class is a decorator for a TaggablePoolInterface. It tags everything with predefined tags.
2020
* Use this class with the DoctrineBridge.
2121
*
2222
* @author Tobias Nyholm <[email protected]>

src/CacheBundle.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public function build(ContainerBuilder $container)
3232
$container->addCompilerPass(new Compiler\CacheTaggingPass());
3333
$container->addCompilerPass(new Compiler\LoggingCompilerPass());
3434
$container->addCompilerPass(new Compiler\SessionSupportCompilerPass());
35-
$container->addCompilerPass(new Compiler\DoctrineSupportCompilerPass());
35+
$container->addCompilerPass(new Compiler\DoctrineCompilerPass());
3636

3737
if ($container->getParameter('kernel.debug')) {
3838
$container->addCompilerPass(new Compiler\DataCollectorCompilerPass());

src/DependencyInjection/CacheExtension.php

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
use Cache\CacheBundle\Bridge\SymfonyValidatorBridge;
1717
use Cache\CacheBundle\Factory\DoctrineBridgeFactory;
1818
use Cache\CacheBundle\Factory\ValidationFactory;
19+
use Cache\CacheBundle\Routing\CachingRouter;
1920
use Symfony\Component\Config\FileLocator;
2021
use Symfony\Component\DependencyInjection\ContainerBuilder;
2122
use Symfony\Component\DependencyInjection\Loader;
@@ -47,6 +48,10 @@ public function load(array $configs, ContainerBuilder $container)
4748
}
4849
}
4950

51+
if ($config['doctrine']['enabled']) {
52+
$this->verifyDoctrineBridgeExists('doctrine');
53+
}
54+
5055
if ($config['annotation']['enabled']) {
5156
$this->verifyDoctrineBridgeExists('annotation');
5257
$container->register('cache.service.annotation', DoctrineCacheBridge::class)
@@ -80,11 +85,11 @@ public function load(array $configs, ContainerBuilder $container)
8085
}
8186

8287
if ($config['router']['enabled']) {
83-
$loader->load('router.yml');
84-
$container->getDefinition('cache.router')
88+
$container->register('cache.service.router', CachingRouter::class)
8589
->setDecoratedService('router', null, 10)
86-
->replaceArgument(0, new Reference($config['router']['service_id']))
87-
->replaceArgument(2, $config['router']['ttl']);
90+
->addArgument(new Reference($config['router']['service_id']))
91+
->addArgument(new Reference('cache.service.router.inner'))
92+
->addArgument($config['router']['ttl']);
8893
}
8994

9095
if ($container->getParameter('kernel.debug')) {
@@ -93,7 +98,7 @@ public function load(array $configs, ContainerBuilder $container)
9398

9499
$serviceIds = [];
95100
$this->findServiceIds($config, $serviceIds);
96-
$container->setParameter('cache.provider.serviceIds', $serviceIds);
101+
$container->setParameter('cache.provider_service_ids', $serviceIds);
97102
}
98103

99104
/**

src/DependencyInjection/Compiler/CacheTaggingPass.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class CacheTaggingPass implements CompilerPassInterface
2727
public function process(ContainerBuilder $container)
2828
{
2929
// get service ids form parameters
30-
$serviceIds = $container->getParameter('cache.provider.serviceIds');
30+
$serviceIds = $container->getParameter('cache.provider_service_ids');
3131

3232
foreach ($serviceIds as $id) {
3333
$def = $container->findDefinition($id);

src/DependencyInjection/Compiler/DoctrineSupportCompilerPass.php renamed to src/DependencyInjection/Compiler/DoctrineCompilerPass.php

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
namespace Cache\CacheBundle\DependencyInjection\Compiler;
1313

14-
use Cache\Bridge\DoctrineCacheBridge;
1514
use Cache\CacheBundle\Cache\FixedTaggingCachePool;
1615
use Cache\CacheBundle\Factory\DoctrineBridgeFactory;
1716
use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException;
@@ -25,7 +24,7 @@
2524
* @author Aaron Scherer <[email protected]>
2625
* @author Tobias Nyholm <[email protected]>
2726
*/
28-
class DoctrineSupportCompilerPass implements CompilerPassInterface
27+
class DoctrineCompilerPass implements CompilerPassInterface
2928
{
3029
/**
3130
* @type ContainerBuilder
@@ -52,12 +51,6 @@ public function process(ContainerBuilder $container)
5251
);
5352
}
5453

55-
if (!class_exists('Cache\Bridge\DoctrineCacheBridge')) {
56-
throw new \Exception(
57-
'You need the DoctrineBridge to be able to cache queries, results and metadata. Please run "composer require cache/psr-6-doctrine-bridge" to install the missing dependency.'
58-
);
59-
}
60-
6154
$this->enableDoctrineSupport($this->container->getParameter('cache.doctrine'));
6255
}
6356

src/Resources/config/router.yml

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

0 commit comments

Comments
 (0)