CodeModel
extends CodeModel
in package
Class created by Core/Internal/PluginsDeploy
Table of Contents
Constants
- ALL_LIMIT = 1000
- MODEL_NAMESPACE = '\FacturaScripts\Dinamic\Model\\'
- SEARCH_LIMIT = 50
Properties
- $code : string
- $description : string
- $dataBase : DataBase
- $limit : int
Methods
- __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
- db() : DataBase
- isValidFieldName() : bool
- Valida que un nombre de campo sea seguro para usar en consultas SQL.
- isValidTableName() : bool
- Valida que un nombre de tabla sea seguro para usar en consultas SQL.
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> = []
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
staticgetDescription()
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
stringgetLimit()
public
static getLimit() : int
Return values
intsearch()
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, Where> $where = [] ]) : array<string|int, static>
Parameters
- $tableName : string
- $fieldCode : string
- $fieldDescription : string
- $query : string
- $where : array<string|int, Where> = []
Return values
array<string|int, static>setLimit()
public
static setLimit(int $newLimit) : void
Parameters
- $newLimit : int
db()
protected
static db() : DataBase
Return values
DataBaseisValidFieldName()
Valida que un nombre de campo sea seguro para usar en consultas SQL.
protected
static isValidFieldName(string $fieldName) : bool
Solo permite letras, números, guiones bajos y puntos (para campos con alias de tabla). También permite el uso de las funciones lower(), upper(), substring() y concat().
Parameters
- $fieldName : string
Return values
boolisValidTableName()
Valida que un nombre de tabla sea seguro para usar en consultas SQL.
protected
static isValidTableName(string $tableName) : bool
Solo permite letras, números y guiones bajos.
Parameters
- $tableName : string