add class Westdc\Metadata\Dataset
This commit is contained in:
parent
2ef3279992
commit
c705293d85
|
@ -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();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
Loading…
Reference in New Issue