v1.0.0
English

BaseModel.php

system/BaseModel.php
1 class 72 methods

class BaseModel

The BaseModel class provides a number of convenient features that makes working with a databases less painful. Extending this class provide means of implementing various database systems It will: - simplifies pagination - allow specifying the return type (array, object, etc) with each call - automatically set and update timestamps - handle soft deletes - ensure validation is run against objects when saving items - process various callbacks - allow intermingling calls to the db connection
__construct (?ValidationInterface $validation = null) public
createDataConverter () protected
useCasts () protected
initialize () protected
doFind (bool $singleton, $id = null) protected
doFindColumn (string $columnName) protected
doFindAll (?int $limit = null, int $offset = 0) protected
doFirst () protected
doInsert (array $row) protected
doInsertBatch (?array $set = null, ?bool $escape = null, int $batchSize = 100, bool $testing = false) protected
doUpdate ($id = null, $row = null) protected
doUpdateBatch (?array $set = null, ?string $index = null, int $batchSize = 100, bool $returnSQL = false) protected
doDelete ($id = null, bool $purge = false) protected
doPurgeDeleted () protected
doOnlyDeleted () protected
doReplace (?array $row = null, bool $returnSQL = false) protected
doErrors () protected
getIdValue ($row) public
countAllResults (bool $reset = true, bool $test = false) public
chunk (int $size, Closure $userFunc) public
find ($id = null) public
findColumn (string $columnName) public
findAll (?int $limit = null, int $offset = 0) public
first () public
save ($row) public
shouldUpdate ($row) protected
getInsertID () public
insert ($row = null, bool $returnID = true) public
setCreatedField (array $row, $date) protected
setUpdatedField (array $row, $date) protected
insertBatch (?array $set = null, ?bool $escape = null, int $batchSize = 100, bool $testing = false) public
update ($id = null, $row = null) public
updateBatch (?array $set = null, ?string $index = null, int $batchSize = 100, bool $returnSQL = false) public
delete ($id = null, bool $purge = false) public
purgeDeleted () public
withDeleted (bool $val = true) public
onlyDeleted () public
replace (?array $row = null, bool $returnSQL = false) public
errors (bool $forceDB = false) public
paginate (?int $perPage = null, string $group = 'default', ?int $page = null, int $segment = 0) public
setAllowedFields (array $allowedFields) public
protect (bool $protect = true) public
doProtectFields (array $row) protected
doProtectFieldsForInsert (array $row) protected
setDate (?int $userData = null) protected
intToDate (int $value) protected
timeToDate (Time $value) protected
skipValidation (bool $skip = true) public
setValidationMessages (array $validationMessages) public
setValidationMessage (string $field, array $fieldMessages) public
setValidationRules (array $validationRules) public
setValidationRule (string $field, $fieldRules) public
cleanRules (bool $choice = false) public
validate ($row) public
getValidationRules (array $options = []) public
ensureValidation () protected
getValidationMessages () public
cleanValidationRules (array $rules, ?array $row = null) protected
allowCallbacks (bool $val = true) public
trigger (string $event, array $eventData) protected
asArray () public
asObject (string $class = 'object') public
objectToArray ($object, bool $onlyChanged = true, bool $recursive = false) protected
timeToString (array $properties) protected
Time ($value) public
objectToRawArray ($object, bool $onlyChanged = true, bool $recursive = false) protected
transformDataToArray ($row, string $type) protected
__get (string $name) public
__isset (string $name) public
__call (string $name, array $params) public
allowEmptyInserts (bool $value = true) public
convertToReturnType (array $row, string $returnType) protected
phpDG v1.0.0 BaseModel.php 662 files 498 classes 763 fn
Generated