add ServiceManagerAwareInterface

This commit is contained in:
Jianxuan Li 2014-12-18 21:14:30 +08:00
parent cc998bc5de
commit f693f1cf45
3 changed files with 22 additions and 10 deletions

View File

@ -1,6 +1,8 @@
<?php
namespace Westdc\Member;
use Zend\ServiceManager\ServiceManager;
use Zend\ServiceManager\ServiceManagerAwareInterface;
use Westdc\EventModel\AbstractEventManager;
use Zend\Authentication\AuthenticationService;
use Zend\Authentication\Storage\Session as SessionStorage;
@ -13,7 +15,8 @@ use Westdc\Db\Db as Zend_Db;
use Westdc\Mail\Mail;
use Westdc\User\Member;
class Account extends AbstractEventManager
class Account extends AbstractEventManager implements ServiceManagerAwareInterface
{
public $memberTable = "tbl_member";
public $FieldUsername = "username";
@ -31,10 +34,24 @@ class Account extends AbstractEventManager
function __construct()
{
$this->db = new Db();
$this->config = Config::get();
}
public function init()
{
$dbService = $this->serviceManager->get('Db');
$this->db = $dbService->getPdo();
}
public function setServiceManager(ServiceManager $serviceManager)
{
$this->serviceManager = $serviceManager;
$this->init();
return $this;
}
//获取账号信息,数组
public function getAccountInfo($id = 0)
{

View File

@ -125,11 +125,4 @@ class Cookie
setcookie('scr','',time()-99999,'/');
}
public function getUser()
{
$sql = "SELECT * FROM ".$this->memberTable." m ORDER BY m.id DESC";
$rs = $this->db->query($sql);
return $rs->fetchAll();
}
}

View File

@ -8,9 +8,11 @@
namespace Westdc\Metadata;
use Zend\ServiceManager\ServiceManager;
use Zend\ServiceManager\ServiceManagerAwareInterface;
class Metadata {
class Metadata implements ServiceManagerAwareInterface{