add user/group ser

This commit is contained in:
cuixin 2015-01-27 02:28:39 +08:00
parent 8214e0ce8d
commit 9bc2e4e065
1 changed files with 47 additions and 0 deletions

47
Westdc/User/Group.php Normal file
View File

@ -0,0 +1,47 @@
<?php
/**
* Created by PhpStorm.
* User: Li Jianxuan
* Date: 14-9-19
* Time: 下午3:21
*/
namespace Westdc\User;
use Zend\ServiceManager\ServiceManager;
use Zend\ServiceManager\ServiceManagerAwareInterface;
class Group 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();
}
/**
* @return mixed
*/
public function fetchAll () {
$sql = "SELECT * FROM groups";
$rs = $this->db->query($sql);
return $rs->fetchAll(\PDO::FETCH_ASSOC);
}
}