【问题标题】:ZF / Doctrine questionZF / 教义问题
【发布时间】: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;
}    

【问题讨论】:

标签: zend-framework doctrine


【解决方案1】:
Doctrine_Query::create()

它创建将运行以查找您的对象的查询。回显对象时,它会打印创建的字符串查询。

需要任何库吗?

好吧,学说 ORM。

您是否阅读过任何手册或遵循教程?好像连怎么回事都不知道?

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-10-31
    • 1970-01-01
    • 1970-01-01
    • 2014-11-05
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多