FacturaScripts

ModelTrait uses trait:short

The class from which all models inherit, connects to the database, check the structure of the table and if necessary create or adapt.

Use FacturaScripts\Core\Template\ModelTrait instead

Table of Contents

Properties

$extensionCache  : array<string|int, mixed>
Cache for extension lookups by method name.
$extensions  : array<string|int, mixed>
Stores class extensions.
$fields  : array<string|int, mixed>
List of fields in the table.

Methods

__call()  : mixed
Executes the first matched extension.
addExtension()  : void
clearExtensions()  : void
Clears all registered extensions.
getExtensions()  : array<string|int, mixed>
Returns a list of all registered extension names.
getModelFields()  : array<string|int, mixed>
Returns the list of fields in the table.
hasExtension()  : bool
modelClassName()  : string
Returns the name of the class of the model.
pipe()  : mixed
pipeFalse()  : bool
removeExtension()  : bool
Removes all extensions with the specified name.
table()  : DbQuery
tableName()  : string
loadModelFields()  : void
Loads table fields if is necessary.
modelName()  : string
Returns the name of the model.
buildExtensionCache()  : void
Builds and caches sorted extensions for a method name.

Properties

$extensionCache

Cache for extension lookups by method name.

protected static array<string|int, mixed> $extensionCache = []

$extensions

Stores class extensions.

protected static array<string|int, mixed> $extensions = []

$fields

List of fields in the table.

protected static array<string|int, mixed> $fields = []

Methods

__call()

Executes the first matched extension.

public __call(string $name[, array<string|int, mixed> $arguments = [] ]) : mixed
Parameters
$name : string
$arguments : array<string|int, mixed> = []
Tags
throws
BadMethodCallException

addExtension()

public static addExtension(mixed $extension[, int $priority = 100 ]) : void
Parameters
$extension : mixed
$priority : int = 100

Priority for all methods in this extension (0-1000, default 100)

clearExtensions()

Clears all registered extensions.

public static clearExtensions() : void

getExtensions()

Returns a list of all registered extension names.

public static getExtensions() : array<string|int, mixed>
Return values
array<string|int, mixed>

getModelFields()

Returns the list of fields in the table.

public getModelFields() : array<string|int, mixed>
Return values
array<string|int, mixed>

hasExtension()

public hasExtension(mixed $name) : bool
Parameters
$name : mixed
Return values
bool

modelClassName()

Returns the name of the class of the model.

public modelClassName() : string
Return values
string

pipe()

public pipe(string $name, array<string|int, mixed> ...$arguments) : mixed
Parameters
$name : string
$arguments : array<string|int, mixed>

pipeFalse()

public pipeFalse(string $name, array<string|int, mixed> ...$arguments) : bool
Parameters
$name : string
$arguments : array<string|int, mixed>
Return values
bool

removeExtension()

Removes all extensions with the specified name.

public static removeExtension(string $name) : bool
Parameters
$name : string
Return values
bool

True if at least one extension was removed

tableName()

public abstract static tableName() : string
Return values
string

loadModelFields()

Loads table fields if is necessary.

protected loadModelFields(DataBase &$dataBase, string $tableName) : void
Parameters
$dataBase : DataBase
$tableName : string

modelName()

Returns the name of the model.

protected modelName() : string
Return values
string

buildExtensionCache()

Builds and caches sorted extensions for a method name.

private buildExtensionCache(string $name) : void
Parameters
$name : string

        
On this page

Search results