fix stupid json unpacking bug turning indexed array to object

This commit is contained in:
2018-08-11 21:51:15 +02:00
parent f6109b5d4a
commit f42e80cc5d
2 changed files with 4 additions and 4 deletions
+2 -2
View File
@@ -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
+2 -2
View File
@@ -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));
}
/**