0
public function executeSearch(sfWebRequest $request)
{
$q = Doctrine_Core::getTable('News')
->createQuery('a')
->where("a.title LIKE ?", array($request->getParameter('text')))
if ($request->getParameter('sub')){
->andWhere('a.subtile = 2');
}
$test = $q->execute();
}
爲什麼不能正常工作?我有一個解析錯誤。 Symfony 1.4應該怎麼做?在Symfony中使用Doctrine搜索系統
如果你使用MySQL,請照顧 - >在哪裏(「a.title LIKE %?%「),它不會在標題列上使用可能的索引! MySQL僅支持右手笑話者(標題LIKE?%)。 – domi27