Also use all keys for an empty array, just in case
This commit is contained in:
parent
2af8fea2be
commit
fefcbb966b
|
@ -50,7 +50,7 @@ class Adapter {
|
||||||
* @throws \Doctrine\DBAL\DBALException
|
* @throws \Doctrine\DBAL\DBALException
|
||||||
*/
|
*/
|
||||||
public function insertIfNotExist($table, $input, array $compare = null) {
|
public function insertIfNotExist($table, $input, array $compare = null) {
|
||||||
if ($compare === null) {
|
if (empty($compare)) {
|
||||||
$compare = array_keys($input);
|
$compare = array_keys($input);
|
||||||
}
|
}
|
||||||
$query = 'INSERT INTO `' .$table . '` (`'
|
$query = 'INSERT INTO `' .$table . '` (`'
|
||||||
|
|
|
@ -29,7 +29,7 @@ class AdapterSqlite extends Adapter {
|
||||||
* @throws \Doctrine\DBAL\DBALException
|
* @throws \Doctrine\DBAL\DBALException
|
||||||
*/
|
*/
|
||||||
public function insertIfNotExist($table, $input, array $compare = null) {
|
public function insertIfNotExist($table, $input, array $compare = null) {
|
||||||
if ($compare === null) {
|
if (empty($compare)) {
|
||||||
$compare = array_keys($input);
|
$compare = array_keys($input);
|
||||||
}
|
}
|
||||||
$fieldList = '`' . implode('`,`', array_keys($input)) . '`';
|
$fieldList = '`' . implode('`,`', array_keys($input)) . '`';
|
||||||
|
|
Loading…
Reference in New Issue