2014-11-14 02:47:39 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Created by PhpStorm.
|
|
|
|
* User: Administrator
|
|
|
|
* Date: 2014/11/11
|
|
|
|
* Time: 11:12
|
|
|
|
*/
|
|
|
|
|
|
|
|
namespace Westdc\Service;
|
|
|
|
|
|
|
|
use Zend\ServiceManager\ServiceManager as Zend_ServiceManager;
|
|
|
|
|
|
|
|
class ServiceManager {
|
|
|
|
|
|
|
|
private $serviceManager;
|
|
|
|
|
|
|
|
function __construct()
|
|
|
|
{
|
|
|
|
$this->serviceManager = new Zend_ServiceManager();
|
|
|
|
$this->serviceManager->addAbstractFactory(new ServiceFactory);
|
2014-12-18 15:38:46 +00:00
|
|
|
|
|
|
|
$configService = $this->serviceManager->get('ConfigService');
|
|
|
|
$invoked_services = $configService->get('service.invoked.ini');
|
|
|
|
|
|
|
|
foreach($invoked_services as $k=>$v) {
|
|
|
|
$this->serviceManager->setInvokableClass($k, $v);
|
|
|
|
}
|
2014-11-14 02:47:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public function addKey($key,$value = "")
|
|
|
|
{
|
|
|
|
if(!empty($value))
|
|
|
|
$this->serviceManager->$key($value);
|
|
|
|
else
|
|
|
|
$this->serviceManager->$key();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setServiceManager(Zend_ServiceManager $service)
|
|
|
|
{
|
|
|
|
$this->serviceManager = $service;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getServiceManager()
|
|
|
|
{
|
|
|
|
return $this->serviceManager;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|