From 1dd78e14f60089b7506ac9b8e4d0b539c68dcd12 Mon Sep 17 00:00:00 2001 From: Jianxuan Li Date: Wed, 31 Dec 2014 00:31:57 +0800 Subject: [PATCH] rename RisOutput as RisExport ,and update to a service,add simpleFetch() in Metadata service --- Westdc/Metadata/Metadata.php | 12 +++ .../{RisOutput.php => RisExport.php} | 74 ++++++++----------- 2 files changed, 42 insertions(+), 44 deletions(-) rename Westdc/Reference/{RisOutput.php => RisExport.php} (63%) diff --git a/Westdc/Metadata/Metadata.php b/Westdc/Metadata/Metadata.php index 4cd419a..4844d80 100644 --- a/Westdc/Metadata/Metadata.php +++ b/Westdc/Metadata/Metadata.php @@ -34,7 +34,19 @@ class Metadata extends AbstractEventManager implements ServiceManagerAwareInterf } + public function simpleFetch($uuid) + { + $sql="select * from metadata where uuid='$uuid'"; + $rs = $this->db->query($sql); + return $rs->fetch(); + }//simpleFetch + + /** + * 通过UUID删除元数据 + * @param $uuid + * @return bool|string + */ public function delete($uuid) { diff --git a/Westdc/Reference/RisOutput.php b/Westdc/Reference/RisExport.php similarity index 63% rename from Westdc/Reference/RisOutput.php rename to Westdc/Reference/RisExport.php index 44b7151..42081ec 100644 --- a/Westdc/Reference/RisOutput.php +++ b/Westdc/Reference/RisExport.php @@ -1,54 +1,40 @@ db = \Zend_Registry::get('db'); - }else{ - $this->db = $db; - } - - $this->config = \Zend_Registry::get('config'); - - //$Listener = new Listener(); - //@$this->events()->attachAggregate($Listener); - - $this->table = new \Helpers\Table(); - } - - public function events(\Zend_EventManager_EventCollection $events = NULL) + + + public function setServiceManager(ServiceManager $serviceManager) { - if ($events !== NULL) { - $this->events = $events; - } elseif ($this->events === NULL) { - $this->events = new \Zend_EventManager_EventManager(__CLASS__); - } - return $this->events; + $this->serviceManager = $serviceManager; + + $this->init(); + + return $this; + } + + public function init() + { + $this->table = new \stdClass; + $this->table->reference = "reference"; + + $dbService = $this->serviceManager->get('Db'); + $this->db = $dbService->getPdo(); } //读取数据 @@ -79,12 +65,12 @@ class RisOutput $risReader = new RISReader(); } - $this->ris = new Ris(); + $this->ris = $this->serviceManager->get('Reference/Ris'); $this->attr = $this->ris->attr; $this->attr_flip = array_flip($this->ris->attr); unset($this->ris); - $this->reference = new Reference(); + $this->reference = $this->serviceManager->get('Reference'); foreach($arrayData as $k=>$v) {