Following the Doctrine DBAL documentation I should be able to bind a list of string values like this:
$sql = 'SELECT * FROM mytable WHERE myfield IN (?)';
$stmt = $conn->prepare($sql);
$stmt->bindValue('myfield', array('stringa', 'stringb', 'stringc'), \Doctrine\DBAL\Connection::PARAM_STR_ARRAY);
$stmt->execute();
This results in a PHP notice and kills my script.
Notice: Array to string conversion in C:\www\eurocampings\vendor\doctrine\dbal\lib\Doctrine\DBAL\Statement.php on line 142
Did I do something wrong?
From Doctrine DBAL documentation:
The parameter list support only works with Doctrine\DBAL\Connection::executeQuery() and Doctrine\DBAL\Connection::executeUpdate(), NOT with the binding methods of a prepared statement.
It is on the end of this link: http://doctrine-dbal.readthedocs.org/en/latest/reference/data-retrieval-and-manipulation.html#list-of-parameters-conversion