프로퍼티 | 타입 | 설명 | |
---|---|---|---|
$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 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 |