Skip to content

Commit c362ad6

Browse files
committed
Adding chain factory, and allowing options to just be an indexed array of service ids
1 parent 4724d79 commit c362ad6

File tree

2 files changed

+33
-1
lines changed

2 files changed

+33
-1
lines changed

src/DependencyInjection/CacheAdapterExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public function load(array $configs, ContainerBuilder $container)
4949

5050
// See if any option has a service reference
5151
foreach ($arguments['options'] as $key => $value) {
52-
if (substr($key, -8) === '_service') {
52+
if (substr($key, -8) === '_service' || strpos($value, '@') === 0) {
5353
$arguments['options'][$key] = new Reference($value);
5454
}
5555
}

src/Factory/ChainFactory.php

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
3+
/*
4+
* This file is part of php-cache organization.
5+
*
6+
* (c) 2015-2015 Aaron Scherer <[email protected]>, Tobias Nyholm <[email protected]>
7+
*
8+
* This source file is subject to the MIT license that is bundled
9+
* with this source code in the file LICENSE.
10+
*/
11+
12+
namespace Cache\AdapterBundle\Factory;
13+
14+
use Cache\Adapter\Chain\CachePoolChain;
15+
16+
/**
17+
* @author Aaron Scherer <[email protected]>
18+
*/
19+
class ChainFactory extends AbstractAdapterFactory
20+
{
21+
protected static $dependencies = [
22+
['requiredClass' => 'Cache\Adapter\Chain\CachePoolChain', 'packageName' => 'cache/chain-adapter'],
23+
];
24+
25+
/**
26+
* {@inheritdoc}
27+
*/
28+
public function getAdapter(array $config)
29+
{
30+
return new CachePoolChain($config);
31+
}
32+
}

0 commit comments

Comments
 (0)