|
Previous Page |
Solar_Model_Nodes |
Next Page |
Properties
Public
None.
Protected
$_Solar_Sql_Model
(array) User-provided configuration.
Inherited from Solar_Sql_Model.
Keys are ...
sql- (dependency) A Solar_Sql dependency.
$_calculate_cols
(array) A list of column names that don't exist in the table, but should be calculated by the model as-needed.
Inherited from Solar_Sql_Model.
$_class
(string) The results of get_class($this) so we don't call get_class() all the time.
Inherited from Solar_Sql_Model.
$_collection_class
(string) The final fallback class for collections of records.
Inherited from Solar_Sql_Model.
Default is Solar_Sql_Model_Collection.
$_config
(array) Collection point for configuration values.
Inherited from Solar_Base.
Note that you do not define config defaults in $_config directly.
<?php
// DO NOT DO THIS
protected $_config = array(
'foo' => 'bar',
'baz' => 'dib',
);
?>
Instead, define config defaults in a protected property named for the class, withan underscore prefix.
For exmple, a "Vendor_Class_Name" class would define the default config array in "$_Vendor_Class_Name". This convention lets child classes inherit parent config keys and values.
<?php
// DO THIS INSTEAD
protected $_Vendor_Class_Name = array(
'foo' => 'bar',
'baz' => 'dib',
);
?>
$_created_col
(string) The column name for 'created' timestamps; default is 'created'.
Inherited from Solar_Sql_Model.
$_fetch_cols
(array) Only fetch these columns from the table.
Inherited from Solar_Sql_Model.
$_filter_class
(string) The class to use for filter chains.
Inherited from Solar_Sql_Model.
$_filters
(array) Filters to validate and sanitize column data.
Inherited from Solar_Sql_Model.
Default is to use validate() and sanitize() methods in the filter class, but if the method exists locally, it will be used instead.
The filters apply only to Record objects from the model; if you use the model insert() and update() methods directly, the filters are not applied.
Example usage follows; note that "_validate" and "_sanitize" refer to internal (protected) filtering methods that have access to the entire data set being filtered.
<?php
// filter 'col_1' to have only alpha chars, with a max length of
// 32 chars
$this->_filters['col_1'][] = 'sanitizeStringAlpha';
$this->_filters['col_1'][] = array('validateMaxLength', 32);
// filter 'col_2' to have only numeric chars, validate as an
// integer, in a range of -10 to +10.
$this->_filters['col_2'][] = 'sanitizeNumeric';
$this->_filters['col_2'][] = 'validateInteger';
$this->_filters['col_2'][] = array('validateRange', -10, +10);
// filter 'handle' to have only alpha-numeric chars, with a length
// of 6-14 chars, and unique in the table.
$this->_filters['handle'][] = 'sanitizeStringAlnum';
$this->_filters['handle'][] = array('validateRangeLength', 6, 14);
$this->_filters['handle'][] = '_validateUnique';
// filter 'email' to have only emails-allowed chars, validate as an
// email address, and be unique in the table.
$this->_filters['email'][] = 'sanitizeStringEmail';
$this->_filters['email'][] = 'validateEmail';
$this->_filters['email'][] = '_validateUnique';
// filter 'passwd' to be not-blank, and should match any existing
// 'passwd_confirm' value.
$this->_filters['passwd'][] = 'validateRequire';
$this->_filters['passwd'][] = '_validateConfirm';
?>
$_foreign_col
(string) Other models that relate to this model should use this as the foreign-key column name.
Inherited from Solar_Sql_Model.
$_index
(array) The index specification array for all indexes on this table.
Inherited from Solar_Sql_Model.
Used only in auto-creation.
The array should be in this format ...
<?php
// the index type: 'normal' or 'unique'
$type = 'normal';
// index on a single column:
// CREATE INDEX idx_name ON table_name (col_name)
$this->_index['idx_name'] = array(
'type' => $type,
'cols' => 'col_name'
);
// index on multiple columns:
// CREATE INDEX idx_name ON table_name (col_1, col_2, ... col_N)
$this->_index['idx_name'] = array(
'type' => $type,
'cols' => array('col_1', 'col_2', ..., 'col_N')
);
// easy shorthand for an index on a single column,
// giving the index the same name as the column:
// CREATE INDEX col_name ON table_name (col_name)
$this->_index['col_name'] = $type;
?>
The $type may be 'normal' or 'unique'.
$_inherit_base
(string) The base model this class is inherited from, in single-table inheritance.
Inherited from Solar_Sql_Model.
$_inherit_col
(string) The column name that tracks single-table inheritance; default is 'inherit'.
Inherited from Solar_Sql_Model.
$_inherit_model
(string) When inheritance is turned on, the class name value for this class in $_inherit_col.
Inherited from Solar_Sql_Model.
$_model_name
(string) When data values for this model are part of an array, use this name as the array key for those values.
Inherited from Solar_Sql_Model.
When inheritance is enabled, the default is the $_inherit_model value, otherwise, the default is the $_table_name.
$_order
(array) The default order when fetching rows.
Inherited from Solar_Sql_Model.
$_paging
(int) The number of rows per page when selecting.
Inherited from Solar_Sql_Model.
$_primary_col
(string) The column name for the primary key; default is 'id'.
Inherited from Solar_Sql_Model.
$_record_class
(string) The final fallback class for an individual record.
Inherited from Solar_Sql_Model.
Default is Solar_Sql_Model_Record.
$_related
(array) Relationships to other Model classes.
Inherited from Solar_Sql_Model.
Keyed on a "virtual" column name, which will be used as a property name in returned records.
$_select_class
(string) The class to use for building SELECT statements.
Inherited from Solar_Sql_Model.
$_sequence_cols
(array) A list of column names that use sequence values.
Inherited from Solar_Sql_Model.
When the column is present in a data array, but its value is null, a sequence value will automatically be added.
$_serialize_cols
(array) A list of column names to serialize/unserialize automatically.
Inherited from Solar_Sql_Model.
Will be unserialized by the Record class as the values are loaded, then re-serialized just before insert/update in the Model class.
$_sql
(Solar_Sql) A Solar_Sql dependency object.
Inherited from Solar_Sql_Model.
$_stack
(Solar_Class_Stack) A Solar_Class_Stack object for fallback hierarchy.
Inherited from Solar_Sql_Model.
$_table_cols
(array) The column specification array for all columns in this table.
Inherited from Solar_Sql_Model.
Used in auto-creation, and for sync-checks.
Will be overridden by _fixTableCols() when it reads the table info, so you don't have to enter anything here ... but if it's empty, you won't get auto-creation.
Each element in this array looks like this...
<?php
$_table_cols = array(
'col_name' => array(
'name' => (string) the col_name, same as the key
'type' => (string) char, varchar, date, etc
'size' => (int) column size
'scope' => (int) decimal places
'default' => (string) default value
'require' => (bool) is this a required (non-null) column?
'primary' => (bool) is this part of the primary key?
'autoinc' => (bool) auto-incremented?
),
);
?>
$_table_name
(string) The table name.
Inherited from Solar_Sql_Model.
$_updated_col
(string) The column name for 'updated' timestamps; default is 'updated'.
Inherited from Solar_Sql_Model.
Private
None.
Local
- Overview
- Constants
- Properties
- Methods
- __call()
- __construct()
- __destruct()
- __get()
- _addFilter()
- _addRelated()
- _belongsTo()
- _createTableAndIndexes()
- _exception()
- _fetchAll()
- _fetchAssoc()
- _fixFilters()
- _fixIndex()
- _fixModelName()
- _fixOrder()
- _fixPropertyCols()
- _fixStack()
- _fixTableCols()
- _fixTableName()
- _fixTagList()
- _hasMany()
- _hasOne()
- _newSelectByTags()
- _setup()
- apiVersion()
- countPages()
- countPagesByTags()
- countPagesRelated()
- delete()
- dump()
- fetch()
- fetchAll()
- fetchAllByTags()
- fetchAssoc()
- fetchCol()
- fetchNew()
- fetchOne()
- fetchPairs()
- fetchRelatedArray()
- fetchRelatedObject()
- fetchValue()
- fixSelectParams()
- getPaging()
- getRelated()
- insert()
- locale()
- newCollection()
- newRecord()
- newSelect()
- serializeCols()
- setPaging()
- unserializeCols()
- update()