Data Retrieval bindVlaue array \Doctrine\DBAL\Connection::PARAM_INT_ARRAY #5627

Closed
opened 2026-01-22 15:13:13 +01:00 by admin · 1 comment
Owner

Originally created by @lcp0578 on GitHub (Aug 4, 2017).

Originally assigned to: @Ocramius on GitHub.

$stmt = $this->getDoctrine()->getEntityManager()
 ->getConnection()
 ->prepare('SELECT t1.id , t1.name
    FROM user t1 
    WHERE  t1.id IN (:ids)');

$stmt->bindValue('ids', $idsArray, \Doctrine\DBAL\Connection::PARAM_INT_ARRAY);
$stmt->execute();

when i use prepare and bindVlaue, get an error?

$stmt = $this->getDoctrine()->getEntityManager()
->getConnection()
->executeQuery('SELECT t1.id , t1.name 
    FROM user t1 
    WHERE t1.id IN (:ids)',
    array('ids' => $idsArray),
    array('ids' => \Doctrine\DBAL\Connection::PARAM_INT_ARRAY)
);

it is work

Originally created by @lcp0578 on GitHub (Aug 4, 2017). Originally assigned to: @Ocramius on GitHub. ``` $stmt = $this->getDoctrine()->getEntityManager() ->getConnection() ->prepare('SELECT t1.id , t1.name FROM user t1 WHERE t1.id IN (:ids)'); $stmt->bindValue('ids', $idsArray, \Doctrine\DBAL\Connection::PARAM_INT_ARRAY); $stmt->execute(); ``` when i use prepare and bindVlaue, get an error? ``` $stmt = $this->getDoctrine()->getEntityManager() ->getConnection() ->executeQuery('SELECT t1.id , t1.name FROM user t1 WHERE t1.id IN (:ids)', array('ids' => $idsArray), array('ids' => \Doctrine\DBAL\Connection::PARAM_INT_ARRAY) ); ``` it is work
admin added the Invalid label 2026-01-22 15:13:13 +01:00
admin closed this issue 2026-01-22 15:13:14 +01:00
Author
Owner

@lcp0578 commented on GitHub (Aug 4, 2017):

error use

@lcp0578 commented on GitHub (Aug 4, 2017): error use
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#5627