Documentation

CoreModel
in package

$this->core->model Class to manage Data Models

Table of Contents

Properties

$cache  : mixed
$db  : CloudSQL
$dbConnection  : mixed
$dbConnections  : mixed
$error  : mixed
$errorCode  : mixed
$errorMsg  : mixed
$models  : mixed
$mongoDB  : DataMongoDB
$core  : mixed

Methods

__construct()  : mixed
dbClose()  : mixed
Close Database connections.
dbCommand()  : mixed
dbDelete()  : bool|null|void
Delete a record into the database. If it exist rewrite it
dbInit()  : bool
Init a DB connection
dbInsert()  : bool|null|void
Insert
dbQuery()  : array<string|int, mixed>|void
Excute the query and return the result if there is no errors
dbUpdate()  : bool|null|void
Update a record into the database
dbUpsert()  : bool|null|void
Upsert a record into the database. If it exist rewrite it
getCache()  : mixed
Get var Cache of the module
getModelObject()  : DataStore|DataSQL|void
listmodels()  : array<string|int, mixed>
Returns the array keys of the models
mongoInit()  : bool
Init a Mongo connection
processModels()  : mixed
Process the model received in models
readCache()  : mixed
Reset Cache of the module
readModels()  : bool
Read models from specific Path
readModelsFromCloudFramework()  : bool|void
Read models from CloudFramework
resetCache()  : mixed
Reset Cache of the module
updateCache()  : mixed
Update Cache of the module
addError()  : mixed

Properties

$cache

public mixed $cache = \null

$dbConnection

public mixed $dbConnection = 'default'

$dbConnections

public mixed $dbConnections = []

$error

public mixed $error = \false

$errorCode

public mixed $errorCode = \null

$errorMsg

public mixed $errorMsg = \null

$models

public mixed $models = \null

$core

protected mixed $core

Methods

__construct()

public __construct(Core7 &$core) : mixed
Parameters
$core : Core7

dbClose()

Close Database connections.

public dbClose([string $connection = '' ]) : mixed
Parameters
$connection : string = ''

Optional it specify to close a specific connection instead of all

dbCommand()

public dbCommand(mixed $title, mixed $q[, mixed $params = [] ]) : mixed
Parameters
$title : mixed
$q : mixed
$params : mixed = []

dbDelete()

Delete a record into the database. If it exist rewrite it

public dbDelete( $title,  $table,  &$data) : bool|null|void
Parameters
$title :
$table :
$data :
Return values
bool|null|void

dbInit()

Init a DB connection

public dbInit([string $connection = '' ][, array<string|int, mixed> $db_credentials = [] ]) : bool
Parameters
$connection : string = ''

optional connection to use. By default $this->dbConnection

$db_credentials : array<string|int, mixed> = []

optional connection to use. By default $this->dbConnection

Return values
bool

dbInsert()

Insert

public dbInsert( $title,  $table,  &$data) : bool|null|void
Parameters
$title :
$table :
$data :
Return values
bool|null|void

dbQuery()

Excute the query and return the result if there is no errors

public dbQuery(mixed $title,  $SQL[,  $params = [] ][,  $types = null ]) : array<string|int, mixed>|void
Parameters
$title : mixed
$SQL :
$params : = []
$types : = null

type format of the fields. Example: ['id':'int(10)']

Return values
array<string|int, mixed>|void

dbUpdate()

Update a record into the database

public dbUpdate( $title,  $table,  &$data) : bool|null|void
Parameters
$title :
$table :
$data :
Return values
bool|null|void

dbUpsert()

Upsert a record into the database. If it exist rewrite it

public dbUpsert( $title,  $table,  &$data) : bool|null|void
Parameters
$title :
$table :
$data :
Return values
bool|null|void

getCache()

Get var Cache of the module

public getCache(mixed $var) : mixed
Parameters
$var : mixed

getModelObject()

public getModelObject(string $object[, array<string|int, mixed> $options = [] ]) : DataStore|DataSQL|void
Parameters
$object : string

We expect a '(db|ds):model_name' or just 'model_name'

$options : array<string|int, mixed> = []

optional options string $namespace says what namespace to use for datastore objects string $projectId says what project_id to use for datastore/bq objects string $cf_models_api_key is the API-KEY to use for CloudFrameworkDataModels and read the structure remotelly

Return values
DataStore|DataSQL|void

listmodels()

Returns the array keys of the models

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

mongoInit()

Init a Mongo connection

public mongoInit([mixed $uri = '' ]) : bool
Parameters
$uri : mixed = ''
Return values
bool

processModels()

Process the model received in models

public processModels( $models) : mixed
Parameters
$models :

array

readCache()

Reset Cache of the module

public readCache() : mixed

readModels()

Read models from specific Path

public readModels( $path) : bool
Parameters
$path :
Return values
bool

readModelsFromCloudFramework()

Read models from CloudFramework

public readModelsFromCloudFramework( $models,  $api_key) : bool|void
Parameters
$models :

string Models separated by ,

$api_key :

string API Key of the licence

Return values
bool|void

resetCache()

Reset Cache of the module

public resetCache() : mixed

updateCache()

Update Cache of the module

public updateCache(mixed $var, mixed $data) : mixed
Parameters
$var : mixed
$data : mixed

addError()

private addError(mixed $msg[, mixed $code = 0 ]) : mixed
Parameters
$msg : mixed
$code : mixed = 0

        
On this page

Search results