My SQL wygląda mniej więcej tak:Doctrine - jak powiązać tablicę z 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();
ale zwraca:
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
nie mogę użytkownik queryBuilder
ponieważ moje prawdziwe SQL jest bardziej skomplikowana (ex zawiera dołączył select, związków i tak dalej).
Czy można użyć foreach? 'foreach ($ accounts jako $ key => $ val) {$ stmt-> bindValue (': userId', $ val); } ' – pes502