Properties
Properties existing in the Solar_Sql_Model
class.
Public
None.
Protected
$_Solar_Sql_Model
(array) Default configuration values.
$_affected_rows
(int) The number of rows affected by the last INSERT, UPDATE, or DELETE.
$_array_name
(string) When a record from this model is part of an form element array, use this name as the array key for it; by default, this is the singular of the model name.
$_cache
(Solar_Sql_Model_Cache) A Solar_Sql_Model_Cache object.
$_cache_class
(string) The class to use for the cache object.
$_calculate_cols
(array) A list of column names that don't exist in the table, but should be calculated by the model as-needed.
$_catalog
(Solar_Sql_Model_Catalog) A Solar_Sql_Model_Catalog dependency object.
$_class
(string) The results of get_class($this) so we don't call get_class() all the time.
$_collection_class
(string) The final fallback class for collections of records.
Default is Solar_Sql_Model_Collection.
$_collection_prototype
(Solar_Sql_Model_Record) A blank instance of the Collection class for this model.
We keep this so we don't keep looking for a collection class once we know what the proper class is.
$_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'.
$_fetch_cols
(array) Only fetch these columns from the table.
$_filter_class
(string) The class to use for filter chains.
$_filters
(array) Filters to validate and sanitize column data.
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'][] = 'validateNotBlank';
$this->_filters['passwd'][] = 'validateConfirm';
$_foreign_col
(string) Other models that relate to this model should use this as the foreign-key column name.
$_index_info
(array) The index specification array for all indexes on this table.
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_info['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_info['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_info['col_name'] = $type;
The $type may be 'normal' or 'unique'.
$_inflect
(Solar_Inflect) The registered Solar_Inflect object.
$_inherit_base
(string) The base model this class is inherited from, in single-table inheritance.
$_inherit_col
(string) The column name that tracks single-table inheritance; default is 'inherit'.
$_inherit_name
(string) When inheritance is turned on, the class name value for this class in $_inherit_col.
$_model_name
(string) The model name is the short form of the class name; this is generally a plural.
When inheritance is enabled, the default is the $_inherit_name value, otherwise, the default is the $_table_name.
$_order
(array) By default, order by this column when fetching rows.
$_paging
(int) The default number of rows per page when selecting.
$_primary_col
(string) The column name for the primary key.
$_record_class
(string) The final fallback class for an individual record.
Default is Solar_Sql_Model_Record.
$_record_prototype
(Solar_Sql_Model_Record) A blank instance of the Record class for this model.
We keep this so we don't keep looking for a record class once we know what the proper class is. Not used when inheritance is in effect.
$_select_class
(string) The class to use for building SELECT statements.
$_sequence_cols
(array) A list of column names that use sequence values.
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 on which to apply serialize() and unserialize() automatically.
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_Adapter) A Solar_Sql dependency object.
$_stack
(Solar_Class_Stack) A Solar_Class_Stack object for fallback hierarchy.
$_table_cols
(array) The column specification array for all columns in this table.
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.
$_updated_col
(string) The column name for 'updated' timestamps; default is 'updated'.
$_xmlstruct_class
(array) The class to use for $_xmlstruct_cols conversion objects.
$_xmlstruct_cols
(array) A list of column names storing XML strings to convert back and forth to Solar_Struct_Xml objects.
Private
None.