added getListOrganize for created new model

This commit is contained in:
Igor Miňo 2025-06-15 19:07:42 +02:00
parent 616dc01c21
commit ae59ffaa97

View File

@ -151,15 +151,19 @@ class ".$name." extends \TPsoft\DBmodel\DBmodel {
->toArray(); ->toArray();
} }
public function getListByID($"."search = array(), $"."reverse = false, $"."concat_or = false) { public function getListOrganize($"."cola_name, $"."search = array(), $"."reverse = false, $"."concat_or = false) {
$"."all = $"."this->getList($"."search, $"."reverse, $"."concat_or); $"."all = $"."this->getList($"."search, $"."reverse, $"."concat_or);
$"."ret = array(); $"."ret = array();
if (is_array($"."all)) foreach ($"."all as $"."key => $"."row) { if (is_array($"."all)) foreach ($"."all as $"."key => $"."row) {
$"."ret[$"."row[$primary_key_name]] = $"."row; $"."ret[$"."row[$"."cola_name]] = $"."row;
} }
return $"."ret; return $"."ret;
} }
public function getListByID($"."search = array(), $"."reverse = false, $"."concat_or = false) {
return $"."this->getListOrganize($primary_key_name, $"."search, $"."reverse, $"."concat_or);
}
public function ".$entity_one."Combo($"."col_key, $"."col_value, $"."add_empty = false) { public function ".$entity_one."Combo($"."col_key, $"."col_value, $"."add_empty = false) {
return $"."this->search('".$entity."') return $"."this->search('".$entity."')
->toCombo($"."col_key, $"."col_value, $"."add_empty); ->toCombo($"."col_key, $"."col_value, $"."add_empty);