title: Doctrine - How to bind array to the SQL?
body: <p>My SQL looks something like this:</p>
  
  <pre><code>$sql = "select * from user where id in (:userId) and status = :status";
  
  $em = $this-&gt;getEntityManager();
  $stmt = $em-&gt;getConnection()-&gt;prepare($sql);
  $stmt-&gt;bindValue(':userId', $accounts, \Doctrine\DBAL\Connection::PARAM_INT_ARRAY);
  $stmt-&gt;bindValue(':status', 'declined');
  $stmt-&gt;execute();
  
  $result = $stmt-&gt;fetchAll();
  </code></pre>
  
  <p>But it returns:</p>
  
  <blockquote>
    <p>An exception occurred while executing (...) </p>
    
    <p>with params
    [[1,2,3,4,5,6,7,8,11,12,13,14], "declined"]</p>
    
    <p>Notice: Array to string conversion</p>
  </blockquote>
  
  <p>I cannot user <code>queryBuilder</code> because my real SQL is more complicated (ex. contains joined select, unions and so on)</p>