Skip to content

Commit

Permalink
Merge pull request #25 from aequasi/master
Browse files Browse the repository at this point in the history
Adding chain factory, and allowing options to just be an indexed arra…
  • Loading branch information
cryptiklemur committed Feb 5, 2016
2 parents cfb4e16 + 860124c commit 91a932f
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/DependencyInjection/CacheAdapterExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function load(array $configs, ContainerBuilder $container)

// See if any option has a service reference
foreach ($arguments['options'] as $key => $value) {
if (substr($key, -8) === '_service') {
if (substr($key, -8) === '_service' || strpos($value, '@') === 0) {
$arguments['options'][$key] = new Reference($value);
}
}
Expand Down
32 changes: 32 additions & 0 deletions src/Factory/ChainFactory.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

/*
* This file is part of php-cache organization.
*
* (c) 2015-2015 Aaron Scherer <aequasi@gmail.com>, Tobias Nyholm <tobias.nyholm@gmail.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/

namespace Cache\AdapterBundle\Factory;

use Cache\Adapter\Chain\CachePoolChain;

/**
* @author Aaron Scherer <aequasi@gmail.com>
*/
class ChainFactory extends AbstractAdapterFactory
{
protected static $dependencies = [
['requiredClass' => 'Cache\Adapter\Chain\CachePoolChain', 'packageName' => 'cache/chain-adapter'],
];

/**
* {@inheritdoc}
*/
public function getAdapter(array $config)
{
return new CachePoolChain($config);
}
}

0 comments on commit 91a932f

Please sign in to comment.