Skip to content
This repository was archived by the owner on Jan 29, 2020. It is now read-only.

Commit 7d18714

Browse files
committed
Expose package as a config-provider / ZF component
Added: - `ConfigProvider`, which enables the `StorageCacheAbstractServiceFactory` by default, as well as maps new entries for the `PatternPluginManager`, storage `PluginManager`, and storage `AdapterPluginManager`. - `Module`, which does the same as the above, but in a zend-mvc context.
1 parent 9594c31 commit 7d18714

File tree

3 files changed

+70
-0
lines changed

3 files changed

+70
-0
lines changed

composer.json

+4
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@
4444
"branch-alias": {
4545
"dev-master": "2.6-dev",
4646
"dev-develop": "2.7-dev"
47+
},
48+
"zf": {
49+
"component": "Zend\\Cache",
50+
"config-provider": "Zend\\Cache\\ConfigProvider"
4751
}
4852
},
4953
"autoload-dev": {

src/ConfigProvider.php

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<?php
2+
/**
3+
* @link http://github.com/zendframework/zend-cache for the canonical source repository
4+
* @copyright Copyright (c) 2005-2016 Zend Technologies USA Inc. (http://www.zend.com)
5+
* @license http://framework.zend.com/license/new-bsd New BSD License
6+
*/
7+
8+
namespace Zend\Cache;
9+
10+
class ConfigProvider
11+
{
12+
/**
13+
* Return default configuration for zend-cache.
14+
*
15+
* @return array
16+
*/
17+
public function __invoke()
18+
{
19+
return [
20+
'dependencies' => $this->getDependencyConfig(),
21+
];
22+
}
23+
24+
/**
25+
* Return default service mappings for zend-cache.
26+
*
27+
* @return array
28+
*/
29+
public function getDependencyConfig()
30+
{
31+
return [
32+
'abstract_factories' => [
33+
Service\StorageCacheAbstractServiceFactory::class,
34+
],
35+
'factories' => [
36+
PatternPluginManager::class => Service\PatternPluginManagerFactory::class,
37+
Storage\AdapterPluginManager::class => Service\StorageAdapterPluginManagerFactory::class,
38+
Storage\PluginManager::class => Service\StoragePluginManagerFactory::class,
39+
],
40+
];
41+
}
42+
}

src/Module.php

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?php
2+
/**
3+
* @link http://github.com/zendframework/zend-cache for the canonical source repository
4+
* @copyright Copyright (c) 2005-2016 Zend Technologies USA Inc. (http://www.zend.com)
5+
* @license http://framework.zend.com/license/new-bsd New BSD License
6+
*/
7+
8+
namespace Zend\Cache;
9+
10+
class Module
11+
{
12+
/**
13+
* Return default zend-cache configuration for zend-mvc context.
14+
*
15+
* @return array
16+
*/
17+
public function getConfig()
18+
{
19+
$provider = new ConfigProvider();
20+
return [
21+
'service_manager' => $provider->getDependencyConfig(),
22+
];
23+
}
24+
}

0 commit comments

Comments
 (0)