PHP Класс TORM\Model

PHP version 5.5
Автор: Eustáquio Rangel ([email protected])
Наследование: use trait torm\Finders, use trait torm\Storage, use trait Persistence, use trait torm\Errors, use trait torm\Validations, use trait torm\Scopes, use trait HasMany, use trait torm\HasOne, use trait torm\BelongsTo, use trait Sequences, use trait Callbacks, use trait torm\Dirty
Показать файл Открыть проект

Открытые свойства

Свойство Тип Описание
$connection
$errors
$yaml_file

Открытые методы

Метод Описание
__call ( string $method, mixed $args ) : null Trigger to use object values as methods Like $user->name("john doe"); echo $user->name();
__construct ( array $data = null ) Constructor
__get ( string $attr ) : attribute Trigger to get object values as attributes Like echo $user->name;
__set ( string $attr, mixed $value ) : null Trigger to set object values as attributes Like $user->name = "john doe";
closeCursor ( mixed $stmt ) : null Close cursor
closeCursorBehaviour ( mixed $action ) : null Behaviour to close cursor
executePrepared ( mixed $obj, mixed $values = [] ) : object Execute a prepared statement, trying to get it from cache.
extractColumns ( ) : string Extract table columns string
extractUpdateColumns ( mixed $values ) : string Extract update columns string
extractWhereConditions ( mixed $conditions ) : string Extract where conditions string Just used for testing, to avoid change the function name withou the underline on all code. This is something PHP should change.
extractWhereValues ( mixed $conditions ) : mixed Extract where values from conditions
get ( string $attr, boolean $current = true ) : mixed Get an attribute value
getColumns ( ) : mixed Return columns
getOrder ( ) : string Returns the default order.
getPK ( ) : string Returns the primary key column.
getReversedOrder ( ) : string Returns the inverse order.
getTableName ( string $cls = null ) : string Returns the table name.
hasColumn ( string $column ) : column Check if a column exists
isIgnoringCase ( ) : boolean Check if is ignoring case
is_new ( ) : boolean Tell if its a new object (not saved)
query ( string $sql ) : mixed Run a SQL query
reload ( ) : mixed Reload the current object
resolveConnection ( ) : object Resolve the current connection handle.
set ( string $attr, mixed $value ) : null Set an attribute value
setConnection ( mixed $con, string $env = "development" ) : null Sets a specific connection for the current model
setOrder ( string $order ) : null Set the default order
setPK ( string $pk ) : null Set the primary key column
setTableName ( string $table_name ) : null Set the model's table name

Приватные методы

Метод Описание
_checkLoaded ( ) : boolean Check if the object columns were loaded
_extractClassName ( $cls ) : string Extract namespace from class name
_extractWhereAssociativeConditions ( mixed $conditions, string $cls, string $escape ) : string Extract where conditions string, from an associative array
_extractWhereAssociativeValues ( mixed $conditions ) : mixed Extract values from an associative array
_extractWhereConditions ( mixed $conditions ) : string Extract where conditions string
_extractWhereRegularConditions ( mixed $conditions, string $cls, string $escape ) : string Extract where conditions string, from a regular array
_extractWhereRegularValues ( mixed $conditions ) : mixed Extract values from a regular array
_loadColumns ( ) : null Load column info
_loadNullValues ( ) : null Load null values on row columns. Useful to new objects.
_makeBuilder ( ) : mixed Create a query builder
_resolveRelations ( string $attr ) : null Resolve relations on an attribute, if present
_validateAfterInitialize ( ) : null Validate after initialize

Описание методов

__call() публичный Метод

Trigger to use object values as methods Like $user->name("john doe"); echo $user->name();
public __call ( string $method, mixed $args ) : null
$method string method
$args mixed arguments
Результат null

__construct() публичный Метод

If data is sent, then it loads columns with it.
public __construct ( array $data = null )
$data array to fill the object

__get() публичный Метод

Trigger to get object values as attributes Like echo $user->name;
public __get ( string $attr ) : attribute
$attr string attribute
Результат attribute value

__set() публичный Метод

Trigger to set object values as attributes Like $user->name = "john doe";
public __set ( string $attr, mixed $value ) : null
$attr string attribute
$value mixed value
Результат null

closeCursor() публичный статический Метод

Close cursor
public static closeCursor ( mixed $stmt ) : null
$stmt mixed statement
Результат null

closeCursorBehaviour() публичный статический Метод

Behaviour to close cursor
public static closeCursorBehaviour ( mixed $action ) : null
$action mixed to use
Результат null

executePrepared() публичный статический Метод

Execute a prepared statement, trying to get it from cache.
public static executePrepared ( mixed $obj, mixed $values = [] ) : object
$obj mixed object
$values mixed to use
Результат object statement

extractColumns() публичный статический Метод

Extract table columns string
public static extractColumns ( ) : string
Результат string columns

extractUpdateColumns() публичный статический Метод

Extract update columns string
public static extractUpdateColumns ( mixed $values ) : string
$values mixed to set columns
Результат string columns

extractWhereConditions() публичный статический Метод

Extract where conditions string Just used for testing, to avoid change the function name withou the underline on all code. This is something PHP should change.
public static extractWhereConditions ( mixed $conditions ) : string
$conditions mixed to extract
Результат string where conditions

extractWhereValues() публичный статический Метод

Extract where values from conditions
public static extractWhereValues ( mixed $conditions ) : mixed
$conditions mixed to extract values
Результат mixed $values

get() публичный Метод

Get an attribute value
public get ( string $attr, boolean $current = true ) : mixed
$attr string attribute
$current boolean current value
Результат mixed attribute value

getColumns() публичный статический Метод

Return columns
public static getColumns ( ) : mixed
Результат mixed columns

getOrder() публичный статический Метод

If not specified, returns an empty string.
public static getOrder ( ) : string
Результат string order

getPK() публичный статический Метод

Returns the primary key column.
public static getPK ( ) : string
Результат string primary key

getReversedOrder() публичный статический Метод

If DESC is specified, returns ASC.
public static getReversedOrder ( ) : string
Результат string order

getTableName() публичный статический Метод

If not specified one, get the current class name and pluralize it.
public static getTableName ( string $cls = null ) : string
$cls string class name
Результат string table name

hasColumn() публичный статический Метод

Check if a column exists
public static hasColumn ( string $column ) : column
$column string to check
Результат column key

isIgnoringCase() публичный статический Метод

Check if is ignoring case
public static isIgnoringCase ( ) : boolean
Результат boolean ignoring case

is_new() публичный Метод

Tell if its a new object (not saved)
public is_new ( ) : boolean
Результат boolean new or not

query() публичный статический Метод

Run a SQL query
public static query ( string $sql ) : mixed
$sql string query
Результат mixed result

reload() публичный Метод

Reload the current object
public reload ( ) : mixed
Результат mixed object

resolveConnection() публичный статический Метод

Get it from PDO or from the current class.
public static resolveConnection ( ) : object
Результат object connection

set() публичный Метод

Set an attribute value
public set ( string $attr, mixed $value ) : null
$attr string attribute
$value mixed value
Результат null

setConnection() публичный статический Метод

Sets a specific connection for the current model
public static setConnection ( mixed $con, string $env = "development" ) : null
$con mixed PDO connection
$env string enviroment
Результат null

setOrder() публичный статический Метод

Set the default order
public static setOrder ( string $order ) : null
$order string default
Результат null

setPK() публичный статический Метод

Set the primary key column
public static setPK ( string $pk ) : null
$pk string primary key
Результат null

setTableName() публичный статический Метод

Set the model's table name
public static setTableName ( string $table_name ) : null
$table_name string table name
Результат null

Описание свойств

$connection публичное статическое свойство

public static $connection

$errors публичное свойство

public $errors

$yaml_file публичное статическое свойство

public static $yaml_file