From dee53af2fca0a591dbad909b4ff3ffb413e12134 Mon Sep 17 00:00:00 2001 From: Jack Freeman Date: Sat, 21 Feb 2015 23:17:27 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=86ServiceManager=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E4=B8=BA=E5=8D=95=E4=BE=8B=E6=A8=A1=E5=BC=8F=EF=BC=8C=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E5=87=A0=E5=A4=84ServiceManager=E8=B0=83=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Westdc/Db/Dbh.php | 1 + .../Listener/DefaultFileUploadListener.php | 2 +- Westdc/Mail/Mail.php | 2 +- Westdc/Mail/Sender.php | 2 +- Westdc/Service/ServiceManager.php | 21 ++++++++++++------- 5 files changed, 17 insertions(+), 11 deletions(-) diff --git a/Westdc/Db/Dbh.php b/Westdc/Db/Dbh.php index 81064ff..cda4914 100644 --- a/Westdc/Db/Dbh.php +++ b/Westdc/Db/Dbh.php @@ -54,6 +54,7 @@ class Dbh } }else{ $sql = "INSERT INTO \"".$table."\" ($fields) VALUES ($datas) RETURNING id"; + //exit($sql); try{ $sth = $this->db->prepare($sql); if($sth->execute()) diff --git a/Westdc/File/Listener/DefaultFileUploadListener.php b/Westdc/File/Listener/DefaultFileUploadListener.php index 4d172bc..2cb4cbb 100644 --- a/Westdc/File/Listener/DefaultFileUploadListener.php +++ b/Westdc/File/Listener/DefaultFileUploadListener.php @@ -14,7 +14,7 @@ class DefaultFileUploadListener implements ListenerAggregateInterface function __construct() { - $this->serviceManager = new ServiceManager(); + $this->serviceManager = ServiceManager::getInstance(); $this->serviceManager = $this->serviceManager->getServiceManager(); } diff --git a/Westdc/Mail/Mail.php b/Westdc/Mail/Mail.php index 6a7b120..b6dd81b 100644 --- a/Westdc/Mail/Mail.php +++ b/Westdc/Mail/Mail.php @@ -43,7 +43,7 @@ class Mail extends AbstractEventManager implements ServiceManagerAwareInterface{ { if(!$this->serviceManager instanceof ServiceManager) { - $serviceManager = new WestdcServiceManager(); + $serviceManager = WestdcServiceManager::getInstance(); $this->serviceManager = $serviceManager->getServiceManager(); } diff --git a/Westdc/Mail/Sender.php b/Westdc/Mail/Sender.php index 51dbc9b..1205c22 100644 --- a/Westdc/Mail/Sender.php +++ b/Westdc/Mail/Sender.php @@ -29,7 +29,7 @@ class Sender implements ServiceManagerAwareInterface{ { if(!$this->serviceManager instanceof ServiceManager) { - $serviceManager = new WestdcServiceManager(); + $serviceManager = WestdcServiceManager::getInstance(); $this->serviceManager = $serviceManager->getServiceManager(); } } diff --git a/Westdc/Service/ServiceManager.php b/Westdc/Service/ServiceManager.php index e323740..d73764d 100644 --- a/Westdc/Service/ServiceManager.php +++ b/Westdc/Service/ServiceManager.php @@ -1,20 +1,25 @@ serviceManager = new Zend_ServiceManager; $this->serviceManager->addAbstractFactory(new ServiceFactory);