Class Model
Core model - reading 'db' section from system config.ini - database PDO connecting by config settings and index - instance loaded variables initializing - instance initialized values reading - virtual calls/sets and gets handling
Direct known subclasses
MvcCore\Ext\Auth\Virtual\UserIndirect known subclasses
MvcCore\Ext\Auth\User
public
array
|
|
public
|
#
SetUp( array $data = array(), boolean $keysInsensitive = FALSE, boolean $includeInheritProperties = TRUE, boolean $publicOnly = TRUE )
Set up given $data items into $this instance context as typed properties by PHP doc comments, as properties with the same names as $data array keys - case sesitively by default. Do not set any $data items which are not declared in $this context. |
public static
|
|
public static
|
#
GetResource( array $args = array(), string $modelClassName = '', string $resourceClassPath = '\Resource' )
Returns (or creates if necessary) model resource instance |
public
|
#
__construct( integer $connectionIndex = -1 )
Creates an instance and inits cfg, db and resource properties |
public
|
|
public static
PDO
|
|
public static
object
|
|
protected static
|
|
public
mixed|
|
#
__call( string $rawName, array $arguments = array() )
Sets any custom property ('PropertyName') by $model->SetPropertyName('value'), which is not necessary to define previously or gets previously defined property ('PropertyName') by $model->GetPropertyName(); Throws exception if no property defined by get call or if virtual call begins with anything different from 'set' or 'get'. This method returns custom value for get and $model instance for set. |
public
|
|
public
mixed
|
protected static
array
|
$connectionArguments
PDO connection arguments. |
#
array(
'4D' => array(
'dsn' => '{driver}:host={host};charset=UTF-8',
'auth' => TRUE,
'fileDb' => FALSE,
'options' => array(),
),
'firebird' => array(
'dsn' => '{driver}:host={host};dbname={dbname};charset=UTF8',
'auth' => TRUE,
'fileDb' => TRUE,
'options' => array()
),
'ibm' => array(
'dsn' => 'ibm:DRIVER={IBM DB2 ODBC DRIVER};DATABASE={dbname};HOSTNAME={host};PORT={port};PROTOCOL=TCPIP;',
'auth' => TRUE,
'fileDb' => FALSE,
'options' => array(),
),
'informix' => array(
'dsn' => '{driver}:host={host};service={service};database={dbname};server={server};protocol={protocol};EnableScrollableCursors=1',
'auth' => TRUE,
'fileDb' => FALSE,
'options' => array(),
),
'mysql' => array(
'dsn' => '{driver}:host={host};dbname={dbname}',
'auth' => TRUE,
'fileDb' => FALSE,
'options' => array(
'\PDO::ATTR_EMULATE_PREPARES' => FALSE, // let params inserting on database
'\PDO::MYSQL_ATTR_MULTI_STATEMENTS' => TRUE,
'\PDO::MYSQL_ATTR_INIT_COMMAND' => "SET NAMES 'UTF8'",
),
),
'sqlite' => array(
'dsn' => '{driver}:{dbname}',
'auth' => FALSE,
'fileDb' => TRUE,
'options' => array(),
),
'sqlsrv' => array(
'dsn' => '{driver}:Server={host};Database={dbname}',
'auth' => TRUE,
'fileDb' => FALSE,
'options' => array(),
),
'default' => array(
'dsn' => '{driver}:host={host};dbname={dbname}',
'auth' => TRUE,
'fileDb' => FALSE,
'options' => array(),
),
)
|
protected static
integer
|
$connectionIndex
Default database connection index, in config ini defined in section db.defaultDbIndex = 0. In extended classes - use this for connection index of current model if different. |
#
-1
|
protected static
array
|
$connections
PDO connections array, keyed by connection indexes from system config |
#
array()
|
protected static
array
|
$instances
Instance of current class if there is necessary to use it as singleton |
#
array()
|
protected static
array
|
$configs
System config sections array with stdClass objects, keyed by connection indexes |
#
array()
|
protected
boolean
|
$autoInit
Automaticly initialize config, db connection and resource class |
#
TRUE
|
protected
PDO
|
$db
PDO instance |
|
protected
stdClass
|
$cfg
System config section for database under called connection index in constructor |
|
protected
|
$resource
Resource model class with SQL statements |