1 つの Doctrine 2 クエリで LIKE ワイルドカードを使用して一致させたい用語の配列があります。データベースは SQL で、私は DQL を使用していますが、クエリ ビルダー ソリューションで問題ありません。私の現在のクエリ設定は次のとおりです。
foreach($textterms as $text)
{
$parameters[] = '%-'.$text.'-%';
}
$em = $this->getDoctrine()->getManager();
$query = $em->createQuery(
'SELECT p FROM Post p WHERE p.searchfield IN LIKE (:text) ORDER BY p.datetime DESC'
)->setParameter('text', $parameters);
$posts = $query->getResult();
しかし、symfony エラー "QueryException: [Syntax Error] line 0, col 62: Error: Expected Literal, got '('" が表示されます
このクエリは教義で可能ですか?