westdc-core/Westdc/Metadata/Dataset.php

51 lines
985 B
PHP
Raw Normal View History

2014-12-21 12:19:17 +00:00
<?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();
}
}