Skip to content
Snippets Groups Projects
Verified Commit 3caa6b53 authored by Damien's avatar Damien
Browse files

FEAT #12091 TIME 0:15 Non searchable statuses in search controller

parent c401ca58
No related branches found
No related tags found
No related merge requests found
...@@ -127,6 +127,13 @@ class SearchController ...@@ -127,6 +127,13 @@ class SearchController
} }
} }
$nonSearchableStatuses = StatusModel::get(['select' => ['id'], 'where' => ['can_be_searched = ?'], 'data' => ['N']]);
if (!empty($nonSearchableStatuses)) {
$nonSearchableStatuses = array_column($nonSearchableStatuses, 'id');
$searchWhere[] = 'status not in (?)';
$searchData[] = $nonSearchableStatuses;
}
$limit = 25; $limit = 25;
if (!empty($queryParams['limit']) && is_numeric($queryParams['limit'])) { if (!empty($queryParams['limit']) && is_numeric($queryParams['limit'])) {
$limit = (int)$queryParams['limit']; $limit = (int)$queryParams['limit'];
......
...@@ -19,17 +19,19 @@ use SrcCore\models\DatabaseModel; ...@@ -19,17 +19,19 @@ use SrcCore\models\DatabaseModel;
abstract class StatusModelAbstract abstract class StatusModelAbstract
{ {
public static function get(array $aArgs = []) public static function get(array $args = [])
{ {
ValidatorModel::arrayType($aArgs, ['select']); ValidatorModel::arrayType($args, ['select', 'where', 'data']);
$aReturn = DatabaseModel::select([ $statuses = DatabaseModel::select([
'select' => empty($aArgs['select']) ? ['*'] : $aArgs['select'], 'select' => empty($args['select']) ? ['*'] : $args['select'],
'table' => ['status'], 'table' => ['status'],
'where' => $args['where'] ?? [],
'data' => $args['data'] ?? [],
'order_by' => ['label_status'] 'order_by' => ['label_status']
]); ]);
return $aReturn; return $statuses;
} }
public static function getById(array $aArgs) public static function getById(array $aArgs)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment