diff --git a/src/Controller/Component/CRUDComponent.php b/src/Controller/Component/CRUDComponent.php index 3c51befc..da00194b 100644 --- a/src/Controller/Component/CRUDComponent.php +++ b/src/Controller/Component/CRUDComponent.php @@ -97,6 +97,8 @@ public function index(array $options): void if ($sort[0] != $this->Table->getAlias()) { $sort[0] = Inflector::camelize(Inflector::pluralize($sort[0])); } + } else { + array_unshift($sort, $this->Table->getAlias()); } $sort = implode('.', $sort); $query->order($sort . ' ' . $direction);