Category Archives: array

Symfony2, DBAL, Doctrine2: create SQL IN Operator from PHP array

$aAccountCode = array(‘blabla1’, ‘accouncode1111’); $oDBALConnection = $this->get(‘database_connection’); $stmt = $oDBALConnection->executeQuery(‘SELECT * FROM table_name WHERE resource_name IN (?)’, array($aAccountCode), array(\Doctrine\DBAL\Connection::PARAM_STR_ARRAY) ); $stmt->execute(); $aAccountID = $stmt->fetchAll( \PDO::FETCH_COLUMN); Advertisements

Posted in array, DBAL, doctrine2, IN, Symfony2 | Leave a comment