OK, found. The reason why the query throws an error is in the where clause. rewrting the query like this works : $q = Doctrine_Query::create()->from('Livre')->where("infos_aliga like ?", '%something%'))->andWhereNotIn('id', array(1,2,3))->execute(); BTW, I found the error while DOHing on very strange results I had with another similar query : the Doctrine_Collection obtained after and execute() was 49 items long despite the fact that I only found 2 rows when running the SQL string (the one given in the logger->debug()) in MySQL Query Browser. The fact that the traces given by the debugger do not match the exact query passed to the database (and I have no idea what query was executed which retrieved those strange 49 rows...) is, to say the least, very confusing... ________________________________
De : symfony-users@googlegroups.com [mailto:symfony-us...@googlegroups.com] De la part de NOOVEO - Christophe Brun Envoyé : vendredi 9 avril 2010 12:24 À : symfony-users@googlegroups.com Objet : [symfony-users] andWhereNotIn clause not working Hi everybody. Here are several Doctrine calls : These ones work (the request is compiled and processed with no errors) : $q = Doctrine_Query::create()->from('Livre')->where("infos_aliga like '%?%'", 'something')->execute(); $q = Doctrine_Query::create()->from('Livre')->whereNotIn('id', array(1,2,3))->execute(); $q = Doctrine_Query::create()->from('Livre')->andWhereNotIn('id', array(1,2,3))->execute(); But this one fails with the following message : SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens $q = Doctrine_Query::create()->from('Livre')->where("infos_aliga like '%?%'", 'something'))->andWhereNotIn('id', array(1,2,3))->execute(); Any ideas of what I am doing wrong ? -- If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -- If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en To unsubscribe, reply using "remove me" as the subject.