class Table (View source)

Manages reading and writing to a database 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.

Properties

$class
$conn
$pk
$last_sql
$columns
$table Name of the table.
$db_name Name of the database (optional)
$sequence Name of the sequence for this table (optional). Defaults to {$table}_seq
$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.
object $callback A instance of CallBack for this model/table

Methods

static 
load($model_class_name)

No description

static 
clear_cache($model_class_name = null)

No description

__construct($class_name)

No description

reestablish_connection($close = true)

No description

create_joins($joins)

No description

options_to_sql($options)

No description

find($options)

No description

cache_key_for_model($pk)

No description

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

No description

get_column_by_inflected_name($inflected_name)

No description

get_fully_qualified_table_name($quote_name = true)

No description

get_relationship($name, $strict = false)

Retrieve a relationship object for this table. Strict as true will throw an error if the relationship name does not exist.

bool
has_relationship($name)

Does a given relationship exist?

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

No description

update($data, $where)

No description

delete($data)

No description

Details

static load($model_class_name)

Parameters

$model_class_name

static clear_cache($model_class_name = null)

Parameters

$model_class_name

__construct($class_name)

Parameters

$class_name

reestablish_connection($close = true)

Parameters

$close

create_joins($joins)

Parameters

$joins

options_to_sql($options)

Parameters

$options

find($options)

Parameters

$options

cache_key_for_model($pk)

Parameters

$pk

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

Parameters

$sql
$values
$readonly
$includes

get_column_by_inflected_name($inflected_name)

Parameters

$inflected_name

get_fully_qualified_table_name($quote_name = true)

Parameters

$quote_name

HasOne|HasMany|BelongsTo get_relationship($name, $strict = false)

Retrieve a relationship object for this table. Strict as true will throw an error if the relationship name does not exist.

Parameters

$name string name of Relationship
$strict bool

Return Value

HasOne|HasMany|BelongsTo Relationship or null

Exceptions

RelationshipException

bool has_relationship($name)

Does a given relationship exist?

Parameters

$name string name of Relationship

Return Value

bool

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

Parameters

$data
$pk
$sequence_name

update($data, $where)

Parameters

$data
$where

delete($data)

Parameters

$data