Skip to content

Commit

Permalink
[update] return get() in the order of only_fields
Browse files Browse the repository at this point in the history
  • Loading branch information
georgehristov committed Aug 6, 2020
1 parent 3e9c79b commit 2d89841
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -820,7 +820,8 @@ public function get(string $field = null)
$data[$field->short_name] = $this->get($field->short_name);
}

return $data;
// return in the order of Model::$only_fields
return array_merge($this->only_fields ? array_flip($this->only_fields): [], $data);
}

$this->assertOnlyFieldsField($field);
Expand Down

0 comments on commit 2d89841

Please sign in to comment.