Свойство | Тип | Описание | |
---|---|---|---|
$arrClassNames | array | Class name cache | |
$arrData | array | Data | |
$arrModified | array | Modified keys | |
$arrRelated | array | Related | |
$arrRelations | array | Relations | |
$blnPreventSaving | boolean | Prevent saving | |
$strPk | string | Primary key | |
$strTable | string | Table name |
Метод | Описание | |
---|---|---|
__callStatic ( string $name, array $args ) : static | |
Magic method to map Model::findByName() to Model::findBy('name') | |
__clone ( ) | Unset the primary key when cloning an object | |
__construct ( |
Load the relations and optionally process a result set | |
__get ( string $strKey ) : mixed | null | Return an object property | |
__isset ( string $strKey ) : boolean | Check whether a property is set | |
__set ( string $strKey, mixed $varValue ) | Set an object property | |
attach ( ) | Attach the model to the registry | |
cloneOriginal ( ) : static | Clone a model with its original values | |
countAll ( ) : integer | Return the total number of rows | |
countBy ( mixed $strColumn = null, mixed $varValue = null, array $arrOptions = [] ) : integer | Return the number of records matching certain criteria | |
current ( ) : static | Return the object instance | |
delete ( ) : integer | Delete the current record and return the number of affected rows | |
detach ( boolean $blnKeepClone = true ) | Detach the model from the registry | |
findAll ( array $arrOptions = [] ) : |
Find all records | |
findBy ( mixed $strColumn, mixed $varValue, array $arrOptions = [] ) : static | |
Find records by various criteria | |
findByIdOrAlias ( mixed $varId, array $arrOptions = [] ) : static | Find a single record by its ID or alias | |
findByPk ( mixed $varValue, array $arrOptions = [] ) : static | Find a single record by its primary key | |
findMultipleByIds ( array $arrIds, array $arrOptions = [] ) : |
Find multiple records by their IDs | |
findOneBy ( mixed $strColumn, mixed $varValue, array $arrOptions = [] ) : static | Find a single record by various criteria | |
getClassFromTable ( string $strTable ) : string | Compile a Model class name from a table name (e.g. tl_form_field becomes FormFieldModel) | |
getPk ( ) : string | Return the name of the primary key | |
getRelated ( string $strKey, array $arrOptions = [] ) : static | |
Lazy load related records | |
getTable ( ) : string | Return the name of the related table | |
getUniqueFields ( ) : array | Return an array of unique field/column names (without the PK) | |
isModified ( ) : boolean | Return true if the model has been modified | |
markModified ( string $strKey ) | Mark a field as modified | |
mergeRow ( array $arrData ) : static | Set the current record from an array preserving modified but unsaved fields | |
onRegister ( |
Called when the model is attached to the model registry | |
onUnregister ( |
Called when the model is detached from the model registry | |
originalRow ( ) : array | Return the original values as associative array | |
preventSaving ( boolean $blnKeepClone = true ) | Prevent saving the model | |
refresh ( ) | Reload the data from the database discarding all modifications | |
row ( ) : array | Return the current record as associative array | |
save ( ) : static | Save the current record | |
setRow ( array $arrData ) : static | Set the current record from an array |
Метод | Описание | |
---|---|---|
buildCountQuery ( array $arrOptions ) : string | Build a query based on the given options to count the number of records | |
buildFindQuery ( array $arrOptions ) : string | Build a query based on the given options | |
createCollection ( array $arrModels, string $strTable ) : |
Create a Model\Collection object | |
createCollectionFromDbResult ( |
Create a new collection from a database result | |
createModelFromDbResult ( |
Create a model from a database result | |
find ( array $arrOptions ) : static | |
Find records and return the model or model collection | |
postFind ( |
Modify the database result before the model is created | |
postSave ( integer $intType ) | Modify the current row after it has been stored in the database | |
preFind ( |
Modify the database statement before it is executed | |
preSave ( array $arrSet ) : array | Modify the current row before it is stored in the database |
public __construct ( |
||
$objResult | An optional database result |
protected static buildCountQuery ( array $arrOptions ) : string | ||
$arrOptions | array | The options array |
Результат | string | The query string |
protected static buildFindQuery ( array $arrOptions ) : string | ||
$arrOptions | array | The options array |
Результат | string | The query string |
public cloneOriginal ( ) : static | ||
Результат | static | The model |
protected static createCollection ( array $arrModels, string $strTable ) : |
||
$arrModels | array | An array of models |
$strTable | string | The table name |
Результат | The Model\Collection object |
protected static createCollectionFromDbResult ( |
||
$objResult | The database result object | |
$strTable | string | The table name |
Результат | The model collection |
protected static createModelFromDbResult ( |
||
$objResult | The database result object | |
Результат | static | The model |
public current ( ) : static | ||
Результат | static | The model object |
public static findBy ( mixed $strColumn, mixed $varValue, array $arrOptions = [] ) : static | |
||
$strColumn | mixed | The property name |
$varValue | mixed | The property value |
$arrOptions | array | An optional options array |
Результат | static | |
A model, model collection or null if the result is empty |
public static findByIdOrAlias ( mixed $varId, array $arrOptions = [] ) : static | ||
$varId | mixed | The ID or alias |
$arrOptions | array | An optional options array |
Результат | static | The model or null if the result is empty |
public static getClassFromTable ( string $strTable ) : string | ||
$strTable | string | The table name |
Результат | string | The model class name |
public static getUniqueFields ( ) : array | ||
Результат | array |
public isModified ( ) : boolean | ||
Результат | boolean | True if the model has been modified |
public markModified ( string $strKey ) | ||
$strKey | string | The field key |
public onRegister ( |
||
$registry | The model registry |
public onUnregister ( |
||
$registry | The model registry |
public originalRow ( ) : array | ||
Результат | array | The original data |
protected static postFind ( |
||
$objResult | The database result object | |
Результат | The database result object |
protected static preFind ( |
||
$objStatement | The database statement object | |
Результат | The database statement object |
public preventSaving ( boolean $blnKeepClone = true ) | ||
$blnKeepClone | boolean | Keeps a clone of the model in the registry |
public refresh ( ) |
public save ( ) : static | ||
Результат | static | The model object |
protected static array $arrClassNames | ||
Результат | array |
protected bool $blnPreventSaving | ||
Результат | boolean |
protected static string $strTable | ||
Результат | string |