PHP Class TORM\Model

PHP version 5.5
Author: Eustáquio Rangel ([email protected])
Inheritance: 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
Afficher le fichier Open project: taq/torm

Méthodes publiques

Свойство Type Description
$connection
$errors
$yaml_file

Méthodes publiques

Méthode Description
__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

Private Methods

Méthode Description
_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

Method Details

__call() public méthode

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
Résultat null

__construct() public méthode

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

__get() public méthode

Trigger to get object values as attributes Like echo $user->name;
public __get ( string $attr ) : attribute
$attr string attribute
Résultat attribute value

__set() public méthode

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
Résultat null

closeCursor() public static méthode

Close cursor
public static closeCursor ( mixed $stmt ) : null
$stmt mixed statement
Résultat null

closeCursorBehaviour() public static méthode

Behaviour to close cursor
public static closeCursorBehaviour ( mixed $action ) : null
$action mixed to use
Résultat null

executePrepared() public static méthode

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
Résultat object statement

extractColumns() public static méthode

Extract table columns string
public static extractColumns ( ) : string
Résultat string columns

extractUpdateColumns() public static méthode

Extract update columns string
public static extractUpdateColumns ( mixed $values ) : string
$values mixed to set columns
Résultat string columns

extractWhereConditions() public static méthode

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
Résultat string where conditions

extractWhereValues() public static méthode

Extract where values from conditions
public static extractWhereValues ( mixed $conditions ) : mixed
$conditions mixed to extract values
Résultat mixed $values

get() public méthode

Get an attribute value
public get ( string $attr, boolean $current = true ) : mixed
$attr string attribute
$current boolean current value
Résultat mixed attribute value

getColumns() public static méthode

Return columns
public static getColumns ( ) : mixed
Résultat mixed columns

getOrder() public static méthode

If not specified, returns an empty string.
public static getOrder ( ) : string
Résultat string order

getPK() public static méthode

Returns the primary key column.
public static getPK ( ) : string
Résultat string primary key

getReversedOrder() public static méthode

If DESC is specified, returns ASC.
public static getReversedOrder ( ) : string
Résultat string order

getTableName() public static méthode

If not specified one, get the current class name and pluralize it.
public static getTableName ( string $cls = null ) : string
$cls string class name
Résultat string table name

hasColumn() public static méthode

Check if a column exists
public static hasColumn ( string $column ) : column
$column string to check
Résultat column key

isIgnoringCase() public static méthode

Check if is ignoring case
public static isIgnoringCase ( ) : boolean
Résultat boolean ignoring case

is_new() public méthode

Tell if its a new object (not saved)
public is_new ( ) : boolean
Résultat boolean new or not

query() public static méthode

Run a SQL query
public static query ( string $sql ) : mixed
$sql string query
Résultat mixed result

reload() public méthode

Reload the current object
public reload ( ) : mixed
Résultat mixed object

resolveConnection() public static méthode

Get it from PDO or from the current class.
public static resolveConnection ( ) : object
Résultat object connection

set() public méthode

Set an attribute value
public set ( string $attr, mixed $value ) : null
$attr string attribute
$value mixed value
Résultat null

setConnection() public static méthode

Sets a specific connection for the current model
public static setConnection ( mixed $con, string $env = "development" ) : null
$con mixed PDO connection
$env string enviroment
Résultat null

setOrder() public static méthode

Set the default order
public static setOrder ( string $order ) : null
$order string default
Résultat null

setPK() public static méthode

Set the primary key column
public static setPK ( string $pk ) : null
$pk string primary key
Résultat null

setTableName() public static méthode

Set the model's table name
public static setTableName ( string $table_name ) : null
$table_name string table name
Résultat null

Property Details

$connection public_oe static_oe property

public static $connection

$errors public_oe property

public $errors

$yaml_file public_oe static_oe property

public static $yaml_file