westdc-core/Westdc/Service/ServiceManager.php

48 lines
1.1 KiB
PHP
Raw Normal View History

<?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);
$configService = $this->serviceManager->get('ConfigService');
$invoked_services = $configService->get('service.invoked.ini');
foreach($invoked_services as $k=>$v) {
$this->serviceManager->setInvokableClass($k, $v);
}
}
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;
}
}