This repository has been archived by the owner on Jan 29, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 122
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Expose package as a config-provider / ZF component
Adds: - `ConfigProvider`, which maps the `AdapterInterface` service to the `AdapterServiceFactory`, and enables the `AdapterAbstractServiceFactory`. - `Module`, which does the same for a zend-mvc context.
- Loading branch information
1 parent
c50a3e1
commit b03f028
Showing
3 changed files
with
68 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?php | ||
/** | ||
* @link http://github.com/zendframework/zend-db for the canonical source repository | ||
* @copyright Copyright (c) 2005-2016 Zend Technologies USA Inc. (http://www.zend.com) | ||
* @license http://framework.zend.com/license/new-bsd New BSD License | ||
*/ | ||
|
||
namespace Zend\Db; | ||
|
||
class ConfigProvider | ||
{ | ||
/** | ||
* Retrieve zend-db default configuration. | ||
* | ||
* @return array | ||
*/ | ||
public function __invoke() | ||
{ | ||
return [ | ||
'dependencies' => $this->getDependencyConfig(), | ||
]; | ||
} | ||
|
||
/** | ||
* Retrieve zend-db default dependency configuration. | ||
* | ||
* @return array | ||
*/ | ||
public function getDependencyConfig() | ||
{ | ||
return [ | ||
'abstract_factories' => [ | ||
Adapter\AdapterAbstractServiceFactory::class, | ||
], | ||
'factories' => [ | ||
Adapter\AdapterInterface::class => Adapter\AdapterServiceFactory::class, | ||
], | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
/** | ||
* @link http://github.com/zendframework/zend-db for the canonical source repository | ||
* @copyright Copyright (c) 2005-2016 Zend Technologies USA Inc. (http://www.zend.com) | ||
* @license http://framework.zend.com/license/new-bsd New BSD License | ||
*/ | ||
|
||
namespace Zend\Db; | ||
|
||
class Module | ||
{ | ||
/** | ||
* Retrieve default zend-db configuration for zend-mvc context. | ||
* | ||
* @return array | ||
*/ | ||
public function getConfig() | ||
{ | ||
$provider = new ConfigProvider(); | ||
return [ | ||
'service_manager' => $provider->getDependencyConfig(), | ||
]; | ||
} | ||
} |