Skip to content

Commit d7ad9fc

Browse files
committed
Fixing conflict
2 parents f939025 + 7e1edeb commit d7ad9fc

File tree

17 files changed

+228
-362
lines changed

17 files changed

+228
-362
lines changed

composer.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,12 @@
3030
"psr/cache": "1.0.x-dev"
3131
},
3232
"require-dev": {
33-
"phpunit/phpunit": "^5.1|^4.0",
34-
"cache/doctrine-cache": "^0.1"
33+
"phpunit/phpunit": "^5.1|^4.0",
34+
"cache/doctrine-adapter": "^0.1",
35+
"cache/taggable-cache": "^0.1"
3536
},
3637
"suggest": {
37-
"php-cache/doctrine-adapter-bundle": "A bundle to register PSR-6 compliant services based on Doctrine cache"
38+
"cache/doctrine-adapter-bundle": "A bundle to register PSR-6 compliant services based on Doctrine cache"
3839
},
3940
"autoload": {
4041
"psr-4": {

phpunit.xml.dist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
processIsolation="false"
1010
stopOnFailure="false"
1111
syntaxCheck="false"
12-
bootstrap="tests/bootstrap.php"
12+
bootstrap="vendor/autoload.php"
1313
>
1414
<testsuites>
1515
<testsuite name="CacheBundle for the Symfony2 Framework">

src/CacheBundle.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ public function build(ContainerBuilder $container)
3131

3232
$container->addCompilerPass(new Compiler\SessionSupportCompilerPass());
3333
$container->addCompilerPass(new Compiler\DoctrineSupportCompilerPass());
34-
$container->addCompilerPass(new Compiler\RouterCompilerPass());
3534

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

src/DependencyInjection/CacheExtension.php

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,17 @@
1111

1212
namespace Cache\CacheBundle\DependencyInjection;
1313

14-
use Cache\CacheBundle\Cache\LoggingCachePool;
15-
use Cache\CacheBundle\DataCollector\CacheDataCollector;
14+
use Symfony\Component\Config\FileLocator;
1615
use Symfony\Component\DependencyInjection\ContainerBuilder;
1716
use Symfony\Component\DependencyInjection\Reference;
1817
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
18+
use Symfony\Component\DependencyInjection\Loader;
19+
1920

2021
/**
21-
* Class AequasiCacheExtension
2222
*
2323
* @author Aaron Scherer <[email protected]>
24+
* @author Tobias Nyholm <[email protected]>
2425
*/
2526
class CacheExtension extends Extension
2627
{
@@ -34,17 +35,24 @@ public function load(array $configs, ContainerBuilder $container)
3435
{
3536
$config = $this->processConfiguration(new Configuration(), $configs);
3637

37-
if ($container->getParameter('kernel.debug')) {
38-
$container->register('data_collector.cache', CacheDataCollector::class)
39-
->addTag('data_collector', ['template' => CacheDataCollector::TEMPLATE, 'id' => 'cache']);
40-
}
38+
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
39+
$loader->load('services.yml');
4140

4241
foreach (['router', 'session', 'doctrine'] as $section) {
4342
if ($config[$section]['enabled']) {
4443
$container->setParameter('cache.'.$section, $config[$section]);
4544
}
4645
}
4746

47+
if ($config['router']['enabled']) {
48+
$container->getDefinition('cache.router_listener')->replaceArgument(0, new Reference($config['router']['service_id']));
49+
} else {
50+
$container->removeDefinition('cache.router_listener');
51+
}
52+
53+
if (!$container->getParameter('kernel.debug')) {
54+
$container->removeDefinition('data_collector.cache');
55+
}
4856
}
4957

5058
public function getAlias()

src/DependencyInjection/Compiler/RouterCompilerPass.php

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

src/DependencyInjection/Configuration.php

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function getConfigTreeBuilder()
4242
}
4343

4444
/**
45-
* Configure the "aequasi_cache.session" section
45+
* Configure the "cache.session" section
4646
*
4747
* @return ArrayNodeDefinition
4848
*/
@@ -69,7 +69,7 @@ private function addSessionSupportSection()
6969
}
7070

7171
/**
72-
* Configure the "aequasi_cache.doctrine" section
72+
* Configure the "cache.doctrine" section
7373
*
7474
* @return ArrayNodeDefinition
7575
*/
@@ -127,7 +127,7 @@ function ($v) {
127127
}
128128

129129
/**
130-
* Configure the "aequasi_cache.router" section
130+
* Configure the "cache.router" section
131131
*
132132
* @return ArrayNodeDefinition
133133
*/
@@ -142,10 +142,7 @@ private function addRouterSection()
142142
->defaultFalse()
143143
->end()
144144
->integerNode('ttl')
145-
->defaultValue(86400)
146-
->end()
147-
->booleanNode('auto-register')
148-
->defaultTrue()
145+
->defaultValue(604800)
149146
->end()
150147
->scalarNode('service_id')
151148
->isRequired()

src/Resources/config/services.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
services:
2+
data_collector.cache:
3+
class: Cache\CacheBundle\DataCollector\CacheDataCollector
4+
tags:
5+
- { name: data_collectorr, template: 'CacheBundle:Collector:cache.html.twig', id: 'cache' }
6+
7+
cache.router_listener:
8+
class: Cache\CacheBundle\Routing\RouterListener
9+
arguments: [~, %cache.router.ttl%]
10+
tags:
11+
- { name: kernel.event_listener, event: kernel.request, method: onBeforeRouting, priority: 33 }
12+
- { name: kernel.event_listener, event: kernel.request, method: onAfterRouting, priority: 31 }

src/Routing/Matcher/CacheUrlMatcher.php

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

src/Routing/Router.php

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

0 commit comments

Comments
 (0)