CodeModel
in package
Auxiliary model to load a list of codes and their descriptions
Tags
Table of Contents
- ALL_LIMIT = 1000
- MODEL_NAMESPACE = '\\FacturaScripts\\Dinamic\\Model\\'
- SEARCH_LIMIT = 50
- $code : string
- $description : string
- $dataBase : DataBase
- $limit : int
- __construct() : mixed
- all() : array<string|int, static>
- Load a CodeModel list (code and description) for the indicated table.
- array2codeModel() : array<string|int, static>
- Convert an associative array (code and value) into a CodeModel array.
- get() : static
- Returns a codemodel with the selected data.
- getDescription() : string
- Returns a description with the selected data.
- getLimit() : int
- search() : array<string|int, static>
- Load a CodeModel list (code and description) for the indicated table and search.
- setLimit() : void
- initDataBase() : void
- Inits database connection.
Constants
ALL_LIMIT
public
mixed
ALL_LIMIT
= 1000
MODEL_NAMESPACE
public
mixed
MODEL_NAMESPACE
= '\\FacturaScripts\\Dinamic\\Model\\'
SEARCH_LIMIT
public
mixed
SEARCH_LIMIT
= 50
Properties
$code
public
string
$code
$description
public
string
$description
$dataBase
protected
static DataBase
$dataBase
$limit
protected
static int
$limit
Methods
__construct()
public
__construct([array<string|int, mixed> $data = [] ]) : mixed
Parameters
- $data : array<string|int, mixed> = []
Return values
mixed —all()
Load a CodeModel list (code and description) for the indicated table.
public
static all(string $tableName, string $fieldCode, string $fieldDescription[, bool $addEmpty = true ][, array<string|int, mixed> $where = [] ]) : array<string|int, static>
Parameters
- $tableName : string
- $fieldCode : string
- $fieldDescription : string
- $addEmpty : bool = true
- $where : array<string|int, mixed> = []
Return values
array<string|int, static> —array2codeModel()
Convert an associative array (code and value) into a CodeModel array.
public
static array2codeModel(array<string|int, mixed> $data[, bool $addEmpty = true ]) : array<string|int, static>
Parameters
- $data : array<string|int, mixed>
- $addEmpty : bool = true
Return values
array<string|int, static> —get()
Returns a codemodel with the selected data.
public
get(string $tableName, string $fieldCode, string $code, string $fieldDescription) : static
Parameters
- $tableName : string
- $fieldCode : string
- $code : string
- $fieldDescription : string
Return values
static —getDescription()
Returns a description with the selected data.
public
getDescription(string $tableName, string $fieldCode, string $code, string $fieldDescription) : string
Parameters
- $tableName : string
- $fieldCode : string
- $code : string
- $fieldDescription : string
Return values
string —getLimit()
public
static getLimit() : int
Return values
int —search()
Load a CodeModel list (code and description) for the indicated table and search.
public
static search(string $tableName, string $fieldCode, string $fieldDescription, string $query[, array<string|int, DataBaseWhere> $where = [] ]) : array<string|int, static>
Parameters
- $tableName : string
- $fieldCode : string
- $fieldDescription : string
- $query : string
- $where : array<string|int, DataBaseWhere> = []
Return values
array<string|int, static> —setLimit()
public
static setLimit(int $newLimit) : void
Parameters
- $newLimit : int
Return values
void —initDataBase()
Inits database connection.
protected
static initDataBase() : void