when I seem to use parameters in my query, I get an error
Invalid parameter number: number of bound variables does not match number of tokens
here is my code
public function GetGeneralRatingWithUserRights($user, $thread_array)
{
$parameters = array(
'thread' => $thread_array['thread'],
'type' => '%'.$thread_array['type'].'%'
);
$dql = 'SELECT p.type,AVG(p.value)
FROM TrackerMembersBundle:Rating p
GROUP BY p.thread,p.type';
$query = $this->em->createQuery($dql)
->setParameters($parameters);
$ratings = $query->execute();
return $ratings;
}
How do I configure the parameters array properly?
thanks all for your efforts, i used it differently using the querybuilder
You didn't include your parameters in the query.
See examples in the documentation: http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/dql-doctrine-query-language.html#dql-select-examples