Hi Esteban Thanks for quick reply. I am new to Doctrine, I tried you solution, but it didn't work. Seamed you are using EntityManager to create query, the setParameters function couldn't take two parameters.
On Mon, Apr 8, 2019 at 4:29 PM Esteban Olm <[email protected]> wrote: > Missing: > > > $result = $em->createQuery($query_DQL) > ->setParameters($params, $params_types) > ->getResult(); > > > El lunes, 8 de abril de 2019, 10:27:57 (UTC+2), Esteban Olm escribió: >> >> Hello, >> >> Try something like: >> >> $query_DQL = 'SELECT ..... WHERE city=:str_id AND id IN >> (:arr_users_ids) '; >> >> $params = Array( >> 'str_id'=>$my_str, >> 'arr_users_ids'=>$arr_users_ids >> ); >> $params_types = Array( >> Connection::PARAM_STR, >> Connection::PARAM_INT_ARRAY >> ); >> >> >> >> El lunes, 8 de abril de 2019, 8:12:52 (UTC+2), Quan Qiu escribió: >>> >>> $sql = "SELECT * FROM FOO WHERE name = ? AND id IN (?)"; >>> >>> $conn = $this->getDoctrine()->getConnection(); >>> >>> $name='abc'; >>> $id_arr = ['5300','5400']; >>> >>> $result = $conn->fetchAll($sql, [$name, $id_arr]); >>> >>> >>> I need to pass both string and array as a parameters to query status, >>> Does anyone can point me how to pass array for IN statement? I did research >>> online, but could not find useful instruction. >>> >>> >>> >>> -- > You received this message because you are subscribed to the Google Groups > "doctrine-user" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at https://groups.google.com/group/doctrine-user. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "doctrine-user" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/doctrine-user. For more options, visit https://groups.google.com/d/optout.
