westdc-core/Westdc/User/Group.php

47 lines
845 B
PHP
Raw Normal View History

2015-01-26 18:28:39 +00:00
<?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);
}
}