0
我們對一個項目使用Zend Framework和Doctrine。我已經使用Doctrine ORM安裝了應用程序。ZF /學說問題
當我回顯語句時,它只打印「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;
}
可能是http://stackoverflow.com/questions/2772902/symfony-and-doctrine-1-2-2-how-can-i-get-the-sql-clause-of-a-doctrine -query-obje – akond 2011-03-15 07:25:35
代碼中的'exit;'肯定會阻止它在'echo $ query;'行後面顯示任何東西。 – 2011-03-15 17:18:28