My SQL simile a questa:Doctrine - Come associare l'array all'SQL?
$sql = "select * from user where id in (:userId) and status = :status";
$em = $this->getEntityManager();
$stmt = $em->getConnection()->prepare($sql);
$stmt->bindValue(':userId', $accounts, \Doctrine\DBAL\Connection::PARAM_INT_ARRAY);
$stmt->bindValue(':status', 'declined');
$stmt->execute();
$result = $stmt->fetchAll();
ma restituisce:
An exception occurred while executing (...)
with params [[1,2,3,4,5,6,7,8,11,12,13,14], "declined"]
Notice: Array to string conversion
non posso utente queryBuilder
perché la mia vera SQL è più complicato (ex contiene unito selezionare, sindacati e così via.)
Puoi usare foreach? 'foreach ($ account come $ chiave => $ val) {$ stmt-> bindValue (': userId', $ val); } ' – pes502