Invalid parameter number: number of bound variables does not match number of tokens in Doctrine

后端 未结 1 1086
一个人的身影
一个人的身影 2020-12-06 15:40

Using Doctrine 2 I want to get some users that are contacts of another user. The table user contains the mapping between those users. The query in the function

相关标签:
1条回答
  • 2020-12-06 16:04

    Don't surround any of the parameters in your query text with quotes!

    ->add('where', "c.owner = ?1 AND c.contact = u.id AND u.username LIKE '?2'")
    

    should be

    ->add('where', "c.owner = ?1 AND c.contact = u.id AND u.username LIKE ?2")
    
    0 讨论(0)
提交回复
热议问题