| @@ 11-38 (lines=28) @@ | ||
| 8 | use Symfony\Component\DependencyInjection\DefinitionDecorator; |
|
| 9 | use Symfony\Component\DependencyInjection\Reference; |
|
| 10 | ||
| 11 | class BroadcasterFactory implements BroadcasterFactoryInterface |
|
| 12 | { |
|
| 13 | public function getKey() |
|
| 14 | { |
|
| 15 | return 'adapter'; |
|
| 16 | } |
|
| 17 | ||
| 18 | public function create(ContainerBuilder $container, $id, array $config) |
|
| 19 | { |
|
| 20 | $container |
|
| 21 | ->setDefinition($id, new DefinitionDecorator('oneup_flysystem.cache.adapter')) |
|
| 22 | ->replaceArgument(0, new Reference(sprintf('oneup_flysystem.%s_adapter', $config['adapter']))) |
|
| 23 | // ->replaceArgument(1, $config['key']) |
|
| 24 | // ->replaceArgument(2, $config['expires']) |
|
| 25 | ; |
|
| 26 | } |
|
| 27 | ||
| 28 | public function addConfiguration(NodeDefinition $node) |
|
| 29 | { |
|
| 30 | $node |
|
| 31 | ->children() |
|
| 32 | ->scalarNode('adapter')->isRequired()->end() |
|
| 33 | ->scalarNode('key')->defaultValue('flysystem')->end() |
|
| 34 | ->scalarNode('expires')->defaultNull()->end() |
|
| 35 | ->end() |
|
| 36 | ; |
|
| 37 | } |
|
| 38 | } |
|
| 39 | ||
| @@ 11-38 (lines=28) @@ | ||
| 8 | use Symfony\Component\DependencyInjection\DefinitionDecorator; |
|
| 9 | use Symfony\Component\DependencyInjection\Reference; |
|
| 10 | ||
| 11 | class BroadcasterFactory implements BroadcasterFactoryInterface |
|
| 12 | { |
|
| 13 | public function getKey() |
|
| 14 | { |
|
| 15 | return 'adapter'; |
|
| 16 | } |
|
| 17 | ||
| 18 | public function create(ContainerBuilder $container, $id, array $config) |
|
| 19 | { |
|
| 20 | $container |
|
| 21 | ->setDefinition($id, new DefinitionDecorator('oneup_flysystem.cache.adapter')) |
|
| 22 | ->replaceArgument(0, new Reference(sprintf('oneup_flysystem.%s_adapter', $config['adapter']))) |
|
| 23 | // ->replaceArgument(1, $config['key']) |
|
| 24 | // ->replaceArgument(2, $config['expires']) |
|
| 25 | ; |
|
| 26 | } |
|
| 27 | ||
| 28 | public function addConfiguration(NodeDefinition $node) |
|
| 29 | { |
|
| 30 | $node |
|
| 31 | ->children() |
|
| 32 | ->scalarNode('adapter')->isRequired()->end() |
|
| 33 | ->scalarNode('key')->defaultValue('flysystem')->end() |
|
| 34 | ->scalarNode('expires')->defaultNull()->end() |
|
| 35 | ->end() |
|
| 36 | ; |
|
| 37 | } |
|
| 38 | } |
|
| 39 | ||