Skip to content

Commit

Permalink
[update] revert sorting of Model::get results
Browse files Browse the repository at this point in the history
  • Loading branch information
georgehristov committed Aug 18, 2020
1 parent 2b60bdd commit 34b8d97
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,7 @@ public function allFields()

private function assertOnlyFieldsField(string $fieldName)
{
$field = $this->getField($fieldName); // test if field exists
$field = $this->getField($fieldName);

if (!$this->isOnlyFieldsField($fieldName) && !$field->system) {
throw (new Exception('Attempt to use field outside of those set by onlyFields'))
Expand Down Expand Up @@ -807,8 +807,7 @@ public function get(string $field = null)
$data[$field->short_name] = $this->get($field->short_name);
}

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

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

0 comments on commit 34b8d97

Please sign in to comment.