FacturaScripts

CodeModel

Auxiliary model to load a list of codes and their descriptions

Table of Contents

ALL_LIMIT 1000
MODEL_NAMESPACE '\\FacturaScripts\\Dinamic\\Model\\'
SEARCH_LIMIT 50
$dataBase It provides direct access to the database. DataBase
$code Value of the code field of the model read. string
$description Value of the field description of the model read. string
__construct() Constructor and class initializer. mixed
all() Load a CodeModel list (code and description) for the indicated table. static[]
array2codeModel() Convert an associative array (code and value) into a CodeModel array. static[]
search() Load a CodeModel list (code and description) for the indicated table and search. static[]
get() Returns a codemodel with the selected data. static
getDescription() Returns a description with the selected data. string
initDataBase() Inits database connection. mixed
toolBox() ToolBox

Constants

MODEL_NAMESPACE

mixed $MODEL_NAMESPACE = '\\FacturaScripts\\Dinamic\\Model\\'

Properties

$dataBase

It provides direct access to the database.

protected static DataBase $dataBase

$code

Value of the code field of the model read.

public string $code

$description

Value of the field description of the model read.

public string $description

Methods

__construct()

Constructor and class initializer.

public __construct( [ $data : array = [] ] ) : mixed
Parameters
$data : array = []
Return values
mixed

all()

Load a CodeModel list (code and description) for the indicated table.

public static all( $tableName : string , $fieldCode : string , $fieldDescription : string [, $addEmpty : bool = true ] [, $where : array = [] ] ) : static[]
Parameters
$tableName : string
$fieldCode : string
$fieldDescription : string
$addEmpty : bool = true
$where : array = []
Return values
static[]

array2codeModel()

Convert an associative array (code and value) into a CodeModel array.

public static array2codeModel( $data : array ) : static[]
Parameters
$data : array
Return values
static[]

search()

Load a CodeModel list (code and description) for the indicated table and search.

public static search( $tableName : string , $fieldCode : string , $fieldDescription : string , $query : string [, $where : \FacturaScripts\Core\Base\DataBase\DataBaseWhere[] = [] ] ) : static[]
Parameters
$tableName : string
$fieldCode : string
$fieldDescription : string
$query : string
$where : \FacturaScripts\Core\Base\DataBase\DataBaseWhere[] = []
Return values
static[]

get()

Returns a codemodel with the selected data.

public get( $tableName : string , $fieldCode : string , $code : string , $fieldDescription : string ) : static
Parameters
$tableName : string
$fieldCode : string
$code : string
$fieldDescription : string
Return values
static

getDescription()

Returns a description with the selected data.

public getDescription( $tableName : string , $fieldCode : string , $code : string , $fieldDescription : string ) : string
Parameters
$tableName : string
$fieldCode : string
$code : string
$fieldDescription : string
Return values
string

initDataBase()

Inits database connection.

protected static initDataBase( ) : mixed
Return values
mixed

Search results