Answer the question
In order to leave comments, you need to log in
How to map data to fields in bacheInsert?
public static $columnsInsert =
[
'id',
'customer_id',
'summary',
'description',
'color',
'favourite',
'update_at',
'create_at',
'personEmail'
];
$sql = $db->queryBuilder->batchInsert(self::$table, self::$columnsInsert, $data);
Answer the question
In order to leave comments, you need to log in
arrow_keys($data[0])
/*
$data = [
0 => ['id' => ..., 'customer_id' => ...],
1 => ['id' => ..., 'customer_id' => ...]
...
]
*/
$sql = $db->queryBuilder->batchInsert(self::$table, arrow_keys($data[0]), $data);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question