diff --git a/app/Controllers/CommonController.php b/app/Controllers/CommonController.php index 515461a..d0efc68 100644 --- a/app/Controllers/CommonController.php +++ b/app/Controllers/CommonController.php @@ -511,10 +511,8 @@ abstract class CommonController extends BaseController $this->total_page = $pager->getPageCount($pager_group); return $pager->links($pager_group, $template); } - protected function index_entitys_process(): array + protected function index_process_orderBy(): void { - $this->index_condition_process(); - //Sorting 처리 $this->order_field = $this->request->getVar('order_field') ?: DEFAULTS['EMPTY']; $this->order_value = $this->request->getVar('order_value') ?: DEFAULTS['EMPTY']; if ($this->order_field !== DEFAULTS['EMPTY'] && $this->order_value !== DEFAULTS['EMPTY']) { @@ -532,10 +530,10 @@ abstract class CommonController extends BaseController "DESC" )); } + } + protected function index_process_limit(): void + { $this->getService()->getModel()->limit($this->per_page, $this->page * $this->per_page - $this->per_page); - $entitys = $this->getService()->getModel()->select($this->getService()->getModel()::TABLE . '.*')->findAll(); - log_message("debug", $this->getService()->getModel()->getLastQuery()); - return $entitys; } protected function index_process_result(): string { @@ -555,7 +553,13 @@ abstract class CommonController extends BaseController //pagenation 처리 $this->pagination = $this->index_pagination_process(); //모델 처리 - $this->entitys = $this->index_entitys_process(); + $this->index_condition_process(); + //Sorting 처리 + $this->index_process_orderBy(); + //Limit관련 + $this->index_process_limit(); + $this->entitys = $this->getService()->getModel()->select($this->getService()->getModel()::TABLE . '.*')->findAll(); + // log_message("debug", $this->getService()->getModel()->getLastQuery()); // 현재 URL을 스택에 저장 $this->myauth->pushCurrentUrl($this->request->getUri()->getPath() . ($this->request->getUri()->getQuery() ? "?" . $this->request->getUri()->getQuery() : "")); return $this->index_process_result();