add class Westdc\Metadata\Dataset

This commit is contained in:
Jianxuan Li 2014-12-21 20:19:17 +08:00
parent 2ef3279992
commit c705293d85
1 changed files with 51 additions and 0 deletions

View File

@ -0,0 +1,51 @@
<?php
/**
* Created by PhpStorm.
* User: liujin834
* Date: 14/12/21
* Time: 下午4:46
*/
namespace Westdc\Metadata;
use Zend\ServiceManager\ServiceManager;
use Zend\ServiceManager\ServiceManagerAwareInterface;
use Westdc\EventModel\AbstractEventManager;
class Dataset extends AbstractEventManager implements ServiceManagerAwareInterface{
protected $serviceManager;
private $db;
public function setServiceManager(ServiceManager $serviceManager)
{
$this->serviceManager = $serviceManager;
$this->init();
return $this;
}
private function init()
{
$dbService = $this->serviceManager->get('Db');
$this->db = $dbService->getPdo();
}
/**
* @param $uuid
* @return mixed
*/
public function fetch($uuid)
{
$sql = "SELECT * FROM dataset WHERE uuid=?";
$sth = $this->db->prepare($sql);
$sth ->execute(array($uuid));
return $sth->fetch();
}
}