Свойство | Type | Description | |
---|---|---|---|
$data | array | An array that holds object data | |
$errors | array | An array that holds insert/update/select errors | |
$isNew | boolean | Flag to define is object is new or loaded from database | |
$pageLimit | integer | Per page limit for pagination | |
$returnType | string | Return type: 'Array' to return results as array, 'Object' as object 'Json' as json string | |
$totalPages | integer | Variable that holds total pages count of last paginate() query |
Свойство | Type | Description | |
---|---|---|---|
$dbTable | stating | Table name for an object. Class name will be used by default | |
$modelPath | modelPath | Models path | |
$primaryKey | stating | Primary key for an object. 'id' is a default value. |
Méthode | Description | |
---|---|---|
__call ( string $method, mixed $arg ) : mixed | Catches calls to undefined methods. | |
__callStatic ( string $method, mixed $arg ) : mixed | Catches calls to undefined static methods. | |
__construct ( array $data = null ) | ||
__get ( $name ) : mixed | Magic getter function | |
__isset ( $name ) | ||
__set ( $name, $value ) : mixed | Magic setter function | |
__toString ( ) : string | Converts object data to a JSON string. | |
__unset ( $name ) | ||
autoload ( $path = null ) | * Enable models autoload from a specified path | |
delete ( ) : boolean | Delete method. Works only if object primaryKey is defined | |
insert ( ) : mixed | ||
save ( $data = null ) : mixed | Save or Update object | |
table ( $tableName ) : dbObject | Helper function to create a virtual table class | |
toArray ( ) : array | Converts object data to an associative array. | |
toJson ( ) : string | Converts object data to a JSON string. | |
update ( array $data = null ) |
Méthode | Description | |
---|---|---|
count ( ) : integer | Function to get a total records count | |
get ( integer | array $limit = null, array | string $fields = null ) : array | Fetch all objects | |
getOne ( array | string $fields = null ) : dbObject | Convinient function to fetch one object. Mostly will be togeather with where() |
Méthode | Description | |
---|---|---|
ArrayBuilder ( ) : dbObject | Helper function to create dbObject with Array return type | |
JsonBuilder ( ) : dbObject | Helper function to create dbObject with Json return type | |
ObjectBuilder ( ) : dbObject | Helper function to create dbObject with Object return type. | |
byId ( $id, array | string $fields = null ) : dbObject | array | Get object by primary key. | |
dbObjectAutoload ( $classname ) | ||
join ( string $objectName, string $key = null, string $joinType = 'LEFT', string $primaryKey = null ) : dbObject | Function to join object with another object. | |
paginate ( integer $page, array | string $fields = null ) : array | Pagination wraper to get() | |
prepareData ( ) | ||
processAllWith ( array &$data, $shouldReset = true ) | Function queries hasMany relations if needed and also converts hasOne object names | |
processArrays ( array &$data ) | ||
processHasOneWith ( ) | * Function building hasOne joins for get/getOne method | |
validate ( array $data ) | ||
with ( string $objectName ) : dbObject | Function to set witch hasOne or hasMany objects should be loaded togeather with a main object |
public __construct ( array $data = null ) | ||
$data | array | Data to preload on object creation |
public __toString ( ) : string | ||
Résultat | string | Converted data |
public static autoload ( $path = null ) | ||
$path |
public static table ( $tableName ) : dbObject | ||
Résultat | dbObject |
protected stating $dbTable | ||
Résultat | stating |
public array $errors | ||
Résultat | array |
public bool $isNew | ||
Résultat | boolean |
protected static modelPath $modelPath | ||
Résultat | modelPath |
public static int $pageLimit | ||
Résultat | integer |
protected stating $primaryKey | ||
Résultat | stating |
public string $returnType | ||
Résultat | string |
public static int $totalPages | ||
Résultat | integer |