Skip to content

Commit edcb148

Browse files
committed
Adding validation to chain factory
1 parent 64ddda7 commit edcb148

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/Factory/ChainFactory.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace Cache\AdapterBundle\Factory;
1313

1414
use Cache\Adapter\Chain\CachePoolChain;
15+
use Symfony\Component\OptionsResolver\OptionsResolver;
1516

1617
/**
1718
* @author Aaron Scherer <[email protected]>
@@ -27,6 +28,17 @@ class ChainFactory extends AbstractAdapterFactory
2728
*/
2829
public function getAdapter(array $config)
2930
{
30-
return new CachePoolChain($config);
31+
return new CachePoolChain($config['services']);
32+
}
33+
34+
/**
35+
* {@inheritdoc}
36+
*/
37+
protected static function configureOptionResolver(OptionsResolver $resolver)
38+
{
39+
parent::configureOptionResolver($resolver);
40+
41+
$resolver->setRequired('services');
42+
$resolver->setAllowedTypes('services', ['array']);
3143
}
3244
}

0 commit comments

Comments
 (0)