fix stupid json unpacking bug turning indexed array to object
This commit is contained in:
@@ -137,10 +137,10 @@ class Proposal extends BaseModel
|
||||
'proposal_id' => $this->getKey(),
|
||||
'note' => $changeset->note,
|
||||
'row_count' => 0, // Will be set later when we are sure about the row count
|
||||
'columns' => array_filter(array_map(function(Column $c) {
|
||||
'columns' => array_values(array_filter(array_map(function(Column $c) {
|
||||
if ($c->toRemove) return null;
|
||||
return $c->toArray(false);
|
||||
}, $columns)),
|
||||
}, $columns))),
|
||||
]);
|
||||
|
||||
$newRevision->save(); // this gives it an ID, needed to associate rows
|
||||
|
||||
@@ -103,12 +103,12 @@ class Column implements JsonSerializable, Arrayable
|
||||
public static function columnsFromJson($columns)
|
||||
{
|
||||
if (is_string($columns)) {
|
||||
$columns = json_decode($columns);
|
||||
$columns = json_decode($columns, true);
|
||||
}
|
||||
|
||||
return array_map(function ($x) {
|
||||
return new Column($x);
|
||||
}, $columns);
|
||||
}, array_values((array)$columns));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user