PHP Class ActiveRecord\Table

This class manages a database table and is used by the Model class for reading and writing to its database table. There is one instance of Table for every table you have a model for.
Exibir arquivo Open project: jpfuentes2/php-activerecord Class Usage Examples

Public Properties

Property Type Description
$cache_individual_model Whether to cache individual models or not (not to be confused with caching of table schemas).
$cache_model_expire Expiration period for model caching.
$callback A instance of CallBack for this model/table
$class
$columns Name/value pairs of columns in this table
$conn
$db_name Name of the database (optional)
$last_sql
$pk
$sequence Name of the sequence for this table (optional). Defaults to {$table}_seq
$table Name of the table.

Public Methods

Method Description
__construct ( $class_name )
cache_key_for_model ( $pk )
clear_cache ( $model_class_name = null )
create_joins ( $joins )
delete ( $data )
find ( $options )
find_by_sql ( $sql, $values = null, $readonly = false, $includes = null )
get_column_by_inflected_name ( $inflected_name )
get_fully_qualified_table_name ( $quote_name = true )
get_relationship ( $name, $strict = false ) : activerecord\HasOne | HasMany | BelongsTo Retrieve a relationship object for this table. Strict as true will throw an error if the relationship name does not exist.
has_relationship ( $name ) : boolean Does a given relationship exist?
insert ( &$data, $pk = null, $sequence_name = null )
load ( $model_class_name )
options_to_sql ( $options )
reestablish_connection ( $close = true )
update ( &$data, $where )

Private Methods

Method Description
add_relationship ( Relationship $relationship ) Add a relationship.
execute_eager_load ( $models = [], $attrs = [], $includes = [] ) : void Executes an eager load of a given named relationship for this table.
get_meta_data ( )
map_names ( &$hash, &$map ) : array Replaces any aliases used in a hash based condition.
process_data ( $hash )
set_associations ( )
set_cache ( )
set_delegates ( ) Rebuild the delegates array into format that we can more easily work with in Model.
set_primary_key ( )
set_sequence_name ( )
set_setters_and_getters ( )
set_table_name ( )

Method Details

__construct() public method

public __construct ( $class_name )

cache_key_for_model() public method

public cache_key_for_model ( $pk )

clear_cache() public static method

public static clear_cache ( $model_class_name = null )

create_joins() public method

public create_joins ( $joins )

delete() public method

public delete ( $data )

find() public method

public find ( $options )

find_by_sql() public method

public find_by_sql ( $sql, $values = null, $readonly = false, $includes = null )

get_column_by_inflected_name() public method

public get_column_by_inflected_name ( $inflected_name )

get_fully_qualified_table_name() public method

public get_fully_qualified_table_name ( $quote_name = true )

get_relationship() public method

Retrieve a relationship object for this table. Strict as true will throw an error if the relationship name does not exist.
public get_relationship ( $name, $strict = false ) : activerecord\HasOne | HasMany | BelongsTo
$name string name of Relationship
$strict bool
return activerecord\HasOne | HasMany | BelongsTo Relationship or null

has_relationship() public method

Does a given relationship exist?
public has_relationship ( $name ) : boolean
$name string name of Relationship
return boolean

insert() public method

public insert ( &$data, $pk = null, $sequence_name = null )

load() public static method

public static load ( $model_class_name )

options_to_sql() public method

public options_to_sql ( $options )

reestablish_connection() public method

public reestablish_connection ( $close = true )

update() public method

public update ( &$data, $where )

Property Details

$cache_individual_model public_oe property

Whether to cache individual models or not (not to be confused with caching of table schemas).
public $cache_individual_model

$cache_model_expire public_oe property

Expiration period for model caching.
public $cache_model_expire

$callback public_oe property

A instance of CallBack for this model/table
public $callback

$class public_oe property

public $class

$columns public_oe property

Name/value pairs of columns in this table
public $columns

$conn public_oe property

public $conn

$db_name public_oe property

Name of the database (optional)
public $db_name

$last_sql public_oe property

public $last_sql

$pk public_oe property

public $pk

$sequence public_oe property

Name of the sequence for this table (optional). Defaults to {$table}_seq
public $sequence

$table public_oe property

Name of the table.
public $table