ユーザー名またはパスワードが間違っていると、このエラーが発生しました。正しいユーザー名とパスワードで正常に実行されます。... 内の非オブジェクトでメンバー関数 count() を呼び出します。
私のコードは
public function executeLogin(sfWebRequest $request)
{
$this->form = new loginForm();
if ($request->isMethod('post'))
{
$this->form->bind($request->getParameter('login'));
if ($this->form->isValid())
{
$unm=$this->form->getValue('username');
$pwd=$this->form->getValue('password');
$q = Doctrine_Query::create()
->select('id')
->from('login')
->andWhere('username = ?', $unm)
->andWhere('password = ?', $pwd);
$q->execute();
$result = $q->fetchOne();
if ($result->count() > 0)
{
$this->getUser()->setAuthenticated(true);
$this->getUser()->addCredential('user');
$this->redirect('user/index');
}
else
{
$this->redirect('user/login');
}
}
}
}