【发布时间】:2011-07-15 13:58:34
【问题描述】:
我们在一个项目中使用 Zend Framework 和 Doctrine。我已经使用 Doctrine ORM 安装了应用程序。
当我回显该语句时,它只打印“FROM User u WHERE u.username = ?”
什么是“Doctrine_Query::create()”?
需要任何库吗?
public function loginAction(){
$error_messages = array();
$params = $this->_request->getParams();
if($_POST)
{
$params = $this->_request->getParams();
$username = $params['username'];
$password = $params['password'];
$query = Doctrine_Query::create()
->from('User u')
->where('u.username = ?',$username);
echo $query;
exit;
$user = $query->execute()->getFirst();
//Authentication !
$authexAdapter = new Application_Auth_exAdapter($user,$password);
$authResult = Zend_Auth::getInstance()->authenticate($authexAdapter);
if(!$authResult->isValid()){
$error_messages = $authResult->getMessages();
} else {
//sucess!
$this->_redirect('account/setup');
}
}
$this->view->error_messages = $error_messages;
}
【问题讨论】:
-
代码中的
exit;肯定会阻止它在echo $query;行之后显示任何内容。