fix: [component:CRUD] Make sure not to override table aliases when paginating
parent
42a5bd03c6
commit
2274fff424
|
@ -90,7 +90,9 @@ class CRUDComponent extends Component
|
||||||
if ($this->_validOrderFields($sort) && ($direction === 'asc' || $direction === 'desc')) {
|
if ($this->_validOrderFields($sort) && ($direction === 'asc' || $direction === 'desc')) {
|
||||||
$sort = explode('.', $sort);
|
$sort = explode('.', $sort);
|
||||||
if (count($sort) > 1) {
|
if (count($sort) > 1) {
|
||||||
$sort[0] = Inflector::camelize(Inflector::pluralize($sort[0]));
|
if ($sort[0] != $this->Table->getAlias()) {
|
||||||
|
$sort[0] = Inflector::camelize(Inflector::pluralize($sort[0]));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$sort = implode('.', $sort);
|
$sort = implode('.', $sort);
|
||||||
$query->order($sort . ' ' . $direction);
|
$query->order($sort . ' ' . $direction);
|
||||||
|
|
Loading…
Reference in New Issue