File tree Expand file tree Collapse file tree 1 file changed +9
-8
lines changed Expand file tree Collapse file tree 1 file changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -142,6 +142,13 @@ public static function prepareAndInsert($rows, $columns = [])
142
142
*/
143
143
public static function insertAssoc ($ rows )
144
144
{
145
+ $ rows = array_values ($ rows );
146
+ if (isset ($ rows [0 ]) && isset ($ rows [1 ])) {
147
+ $ keys = array_keys ($ rows [0 ]);
148
+ foreach ($ rows as &$ row ) {
149
+ $ row = array_replace (array_flip ($ keys ), $ row );
150
+ }
151
+ }
145
152
return static ::getClient ()->insertAssocBulk ((new static )->getTable (), $ rows );
146
153
}
147
154
@@ -152,14 +159,8 @@ public static function insertAssoc($rows)
152
159
*/
153
160
public static function prepareAndInsertAssoc ($ rows )
154
161
{
155
- $ rows = array_values (array_map ('static::prepareAssocFromRequest ' , $ rows ));
156
- if (isset ($ rows [0 ]) && isset ($ rows [1 ])) {
157
- $ keys = array_keys ($ rows [0 ]);
158
- foreach ($ rows as &$ row ) {
159
- $ row = array_replace (array_flip ($ keys ), $ row );
160
- }
161
- }
162
- return static ::getClient ()->insertAssocBulk ((new static )->getTable (), $ rows );
162
+ $ rows = array_map ('static::prepareAssocFromRequest ' , $ rows );
163
+ return static ::insertAssoc ($ rows );
163
164
}
164
165
165
166
/**
You can’t perform that action at this time.
0 commit comments