westdc-core/Westdc/User/User.php

46 lines
884 B
PHP
Raw Normal View History

2014-09-19 09:10:29 +00:00
<?php
/**
* Created by PhpStorm.
* User: Li Jianxuan
* Date: 14-9-19
* Time: 下午3:21
*/
namespace Westdc\User;
2014-12-19 02:25:49 +00:00
use Zend\ServiceManager\ServiceManager;
use Zend\ServiceManager\ServiceManagerAwareInterface;
use Westdc\EventModel\AbstractEventManager;
2014-09-19 09:10:29 +00:00
2014-12-19 02:25:49 +00:00
class User extends AbstractEventManager implements ServiceManagerAwareInterface{
2014-09-19 09:10:29 +00:00
2014-12-19 02:25:49 +00:00
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();
}
2014-12-19 03:58:47 +00:00
public function fetchAll(){
$sql = "select * from users where usertype = 'member'";
$rs = $this->db->query($sql);
return $rs->fetchAll(\PDO::FETCH_ASSOC);
}
2014-12-19 02:25:49 +00:00
2014-09-19 09:10:29 +00:00
}