From 5e29bfadd64732eebc95b4ba61ab9b769371fca9 Mon Sep 17 00:00:00 2001 From: Georgi Hristov Date: Thu, 6 Aug 2020 11:10:05 +0200 Subject: [PATCH] [update] revert sorting of Model::get results --- src/Model.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/Model.php b/src/Model.php index b23aed44cf..f7af7b7d54 100644 --- a/src/Model.php +++ b/src/Model.php @@ -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')) @@ -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);