static $active_connections = array()
[line 166]
Stores the active connections. Indexed on $connection_name.
Tags:
static $begin_executed = false
[line 427]
Transactions (only use if your db supports it)
This is for transactions only to let query() know that a 'BEGIN' has been executed
Tags:
static $database_settings = array()
[line 161]
Stores the database settings
Tags:
static $db = null
[line 75]
Reference to the database object
Reference to the database object returned by PEAR MDB2::Connect()
Tags:
static $query_log = array()
[line 438]
Keep a log of queries executed if in development env
Tags:
static $table_info = array()
[line 109]
Table Info
Array to hold all the info about table columns. Indexed on $table_name.
Tags:
static $use_transactions = false
[line 433]
Transactions (only use if your db supports it) This will issue a rollback command if any sql fails.
Tags:
$aggregations = array("count","sum","avg","max","min")
[line 318]
SQL aggregate functions that may be applied to the associated table.
SQL defines aggregate functions AVG, COUNT, MAX, MIN and SUM. Not all of these functions are implemented by all DBMS's
Tags:
$auto_create_timestamps = array("created_at","created_on")
[line 281]
Names of automatic create timestamp columns
When a row containing one of these columns is created and $auto_timestamps is true, store the current date and time in the timestamp columns.
Tags:
$auto_delete_habtm = true
[line 421]
Auto delete $has_and_belongs_to_many associations
Tags:
$auto_save_associations = true
[line 246]
Whether or not to auto save defined associations if set
Tags:
$auto_save_habtm = true
[line 416]
Auto insert / update $has_and_belongs_to_many tables
Tags:
$auto_timestamps = true
[line 411]
Whether to automatically update timestamps in certain columns
Tags:
$auto_update_timestamps = array("updated_at","updated_on")
[line 269]
Names of automatic update timestamp columns
When a row containing one of these columns is updated and $auto_timestamps is true, update the contents of the timestamp columns with the current date and time.
Tags:
$belongs_to = null
[line 229]
Tags:
$builtin_validation_functions = array(
'validates_acceptance_of',
'validates_confirmation_of',
'validates_exclusion_of',
'validates_format_of',
'validates_inclusion_of',
'validates_length_of',
'validates_numericality_of',
'validates_presence_of',
'validates_uniqueness_of'
)
[line 392]
An array of all the builtin validation function calls.
Tags:
$class_name = null
[line 119]
Class name
Name of the child class. (this is optional and will automatically be determined) Normally set to the singular camel case form of the table name. May be overridden.
Tags:
$composed_of = null
[line 204]
Composite custom user created objects
Tags:
$connection_name = TRAX_ENV
[line 156]
Index into the $active_connections array
Name of the index to use to return or set the current db connection Mainly used if you want to connect to different databases between different models.
Tags:
$content_columns = null
[line 101]
Description of a row in the associated table in the database
Retrieved from the RDBMS by set_content_columns(). See DB_common::tableInfo() for the format. NOTE: Some RDBMS's don't return all values.
An additional element 'human_name' is added to each column by set_content_columns(). The actual value contained in each column is stored in an object variable with the name given by the 'name' element of the column description for each column.
NOTE:The information from the database about which columns are primary keys is not used. Instead, the primary keys in the table are listed in $primary_keys, which is maintained independently.
Tags:
$database_name = null
[line 146]
Database name override
Name of the database to use, if you are not using the value read from file config/database.ini
Tags:
$date_format = "Y-m-d"
[line 290]
Date format for use with auto timestamping
The format for this should be compatiable with the php date() function. http://www.php.net/date
Tags:
$default_error_messages = array(
'inclusion' => "is not included in the list",
'exclusion' => "is reserved",
'invalid' => "is invalid",
'confirmation' => "doesn't match confirmation",
'accepted ' => "must be accepted",
'empty' => "can't be empty",
'blank' => "can't be blank",
'too_long' => "is too long (max is %d characters)",
'too_short' => "is too short (min is %d characters)",
'wrong_length' => "is the wrong length (should be %d characters)",
'taken' => "has already been taken",
'not_a_number' => "is not a number",
'not_an_integer' => "is not an integer"
)
[line 373]
An array with all the default error messages.
Tags:
$display = 10
[line 346]
Pagination how many numbers in the list < 1 2 3 4 > >>
Tags:
$errors = array()
[line 368]
Description of non-fatal errors found
For every non-fatal error found, an element describing the error is added to $errors. Initialized to an empty array in valid() before validating object. When an error message is associated with a particular attribute, the message should be stored with the attribute name as its key. If the message is independent of attributes, store it with a numeric key beginning with 0.
Tags:
$fetch_mode = MDB2_FETCHMODE_ASSOC
[line 176]
Mode to use when fetching data from database
See the relevant PEAR MDB2 class documentation
Tags:
$force_reconnect = false
[line 183]
Force reconnect to database every page load
Tags:
$habtm_attributes = null
[line 235]
Tags:
$has_and_belongs_to_many = null
[line 223]
Tags:
$has_many = null
[line 211]
Tags:
$has_one = null
[line 217]
Tags:
$index_on = "id"
[line 191]
find_all() returns an array of objects, each object index is off of this field
Tags:
$lock_optimistically = true
[line 198]
Not yet implemented (page 222 Rails books)
Tags:
$new_record = true
[line 257]
Whether this object represents a new record
true => This object was created without reading a row from the database, so use SQL 'INSERT' to put it in the database. false => This object was a row read from the database, so use SQL 'UPDATE' to update database with new values.
Tags:
$pagination_count = 0
[line 351]
Tags:
$preserve_null_dates = true
[line 308]
Whether to keep date/datetime fields NULL if not set
true => If date field is not set it try to preserve NULL false => Don't try to preserve NULL if field is already NULL
Tags:
$primary_keys = array("id")
[line 335]
Primary key of the associated table
Array element(s) name the primary key column(s), as used to specify the row to be updated or deleted. To be a primary key a column must be listed both here and in $content_columns. NOTE:This field is maintained by hand. It is not derived from the table description read from the database.
Tags:
$rows_per_page_default = 20
[line 341]
Default for how many rows to return from find_all()
Tags:
$save_associations = array()
[line 240]
Tags:
$table_name = null
[line 129]
Table name
Name of the table in the database associated with the subclass. Normally set to the pluralized lower case underscore form of the class name by the constructor. May be overridden.
Tags:
$table_prefix = null
[line 137]
Table prefix
Name to prefix to the $table_name. May be overridden.
Tags:
$time_format = "H:i:s"
[line 299]
Time format for use with auto timestamping
The format for this should be compatiable with the php date() function. http://www.php.net/date
Tags:
constructor __construct [line 456]
ActiveRecord __construct(
[string[]
$attributes = null])
|
|
Construct an ActiveRecord object
- Establish a connection to the database
- Find the name of the table associated with this object
- Read description of this table from the database
- Optionally apply update information to column attributes
Tags:
Parameters:
method add_error [line 3173]
void add_error(
string
$error, [string
$key = null])
|
|
Add or overwrite description of an error to the list of errors
Tags:
Parameters:
method add_habtm_records [line 2034]
void add_habtm_records(
$this_foreign_value)
|
|
Tags:
Parameters:
method add_record [line 1686]
Insert a new row in the table associated with this object
Build an SQL INSERT statement getting the table name from $table_name, the column names from $content_columns and the values from object variables. Send the insert to the RDBMS.
Tags:
method add_record_or_update_record [line 1647]
boolean add_record_or_update_record(
)
|
|
Create or update a row in the table
If this object represents a new row in the table, insert it. Otherwise, update the exiting row. before_?() and after_?() routines will be called depending on whether the row is new.
Tags:
method after_create [line 2770]
Is called after save() on new objects that havent been saved yet (no record exists).
Tags:
method after_delete [line 2794]
Is called after delete().
Tags:
method after_save [line 2758]
Is called after save (regardless of whether its a create or update save).
Tags:
method after_update [line 2782]
Is called after save() on existing objects that has a record.
Tags:
method after_validation [line 2722]
Is called after validate().
Tags:
method after_validation_on_create [line 2734]
void after_validation_on_create(
)
|
|
Is called after validate() on new objects that haven't been saved yet (no record exists).
Tags:
method after_validation_on_update [line 2746]
void after_validation_on_update(
)
|
|
Is called after validate() on existing objects that has a record.
Tags:
method aggregate_all [line 956]
void aggregate_all(
$aggregate_type, [string[]
$parameters = null], string
$agrregrate_type)
|
|
Implement *_all() functions (SQL aggregate functions)
Apply one of the SQL aggregate functions to a column of the table associated with this object. The SQL aggregate functions are AVG, COUNT, MAX, MIN and SUM. Not all DBMS's implement all of these functions.
Tags:
Parameters:
method attribute_is_string [line 2558]
void attribute_is_string(
string
$attribute, [
$column = null])
|
|
Determine if passed in attribute (table column) is a string
Tags:
Parameters:
method before_create [line 2764]
Is called before save() on new objects that havent been saved yet (no record exists).
Tags:
method before_delete [line 2788]
Is called before delete().
Tags:
method before_save [line 2752]
Is called before save() (regardless of whether its a create or update save)
Tags:
method before_update [line 2776]
Is called before save() on existing objects that has a record.
Tags:
method before_validation [line 2716]
void before_validation(
)
|
|
Is called before validate().
Tags:
method before_validation_on_create [line 2728]
void before_validation_on_create(
)
|
|
Is called before validate() on new objects that haven't been saved yet (no record exists).
Tags:
method before_validation_on_update [line 2740]
void before_validation_on_update(
)
|
|
Is called before validate() on existing objects that has a record.
Tags:
method begin [line 1090]
Only used if you want to do transactions and your db supports transactions
Tags:
method build_sql [line 1234]
void build_sql(
[
$conditions = null], [
$order = null], [
$limit = null], [
$joins = null])
|
|
Builds a sql statement.
Tags:
Parameters:
method check_datetime [line 2112]
mixed check_datetime(
string
$field, mixed
$value)
|
|
Apply automatic timestamp updates
If automatic timestamps are in effect (as indicated by $auto_timestamps == true) and the column named in the $field argument is of type "timestamp" and matches one of the names in auto_create_timestamps or auto_update_timestamps(as selected by $new_record), then return the current date and time as a string formatted to insert in the database. Otherwise return $value.
Tags:
Parameters:
method column_attribute_exists [line 1048]
boolean column_attribute_exists(
string
$attribute)
|
|
Check whether a column exists in the associated table
When called, $content_columns lists the columns in the table described by this object.
Tags:
Parameters:
method column_for_attribute [line 1015]
void column_for_attribute(
$attribute)
|
|
get the attributes for a specific column.
Tags:
Parameters:
method column_type [line 1031]
void column_type(
$attribute)
|
|
get the columns data type.
Tags:
Parameters:
method commit [line 1101]
Only used if you want to do transactions and your db supports transactions
Tags:
method create [line 1548]
void create(
$attributes, [
$dont_validate = false])
|
|
Tags:
Parameters:
method delete [line 1917]
void delete(
[
$id = null])
|
|
Deletes the record with the given $id or if you have done a $model = $model->find($id), then $model->delete() it will delete the record it just loaded from the find() without passing anything to delete(). If an array of ids is provided, all ids in array are deleted.
Tags:
Parameters:
method delete_all [line 1981]
boolean delete_all(
[string
$conditions = null])
|
|
Delete from table all rows that match argument
Delete the row(s), if any, matching the argument.
Tags:
Parameters:
method delete_all_habtm_records [line 2079]
void delete_all_habtm_records(
$other_table_name,
$this_foreign_value)
|
|
Tags:
Parameters:
method delete_habtm_records [line 2069]
void delete_habtm_records(
$this_foreign_value)
|
|
Tags:
Parameters:
method escape [line 2315]
Escapes a string for use in an sql statement.
Parameters:
method establish_connection [line 2502]
void establish_connection(
)
|
|
Open a database connection if one is not currently open
The name of the database normally comes from $database_settings which is set in environment.php by reading file config/database.ini. The database name may be overridden by assigning a different name to $database_name.
If there is a connection now open, as indicated by the saved value of a MDB2 object in $active_connections[$connection_name], and force_reconnect is not true, then set the database fetch mode and return.
If there is no connection, open one and save a reference to it in $active_connections[$connection_name].
Tags:
method find [line 1430]
mixed find(
mixed[]
$id, [string
$order = null], [integer[]
$limit = null], [string
$joins = null])
|
|
Find row(s) with specified value(s)
Find all the rows in the table which match the argument $id. Return zero or more objects of the same class as this class representing the rows that matched the argument.
Tags:
Parameters:
method find_all [line 1356]
object[] find_all(
[string
$conditions = null], [string
$order = null], [integer[]
$limit = null], [string
$joins = null])
|
|
Return rows selected by $conditions
If no rows match, an empty array is returned.
Tags:
Parameters:
method find_all_habtm [line 643]
void find_all_habtm(
$other_table_name, [
$parameters = null])
|
|
Find all records using a "has_and_belongs_to_many" relationship
(many-to-many with a join table in between). Note that you can also specify an optional "paging limit" by setting the corresponding "limit" instance variable. For example, if you want to return 10 movies from the 5th movie on, you could set $this->movies_limit = "10, 5"
Parameters: $this_table_name: The name of the database table that has the one row you are interested in. E.g. genres $other_table_name: The name of the database table that has the many rows you are interested in. E.g. movies Returns: An array of ActiveRecord objects. (e.g. Movie objects)
Tags:
Parameters:
method find_all_has_many [line 741]
void find_all_has_many(
$other_table_name, [
$parameters = null])
|
|
Find all records using a "has_many" relationship (one-to-many)
Parameters: $other_table_name: The name of the other table that contains many rows relating to this object's id. Returns: An array of ActiveRecord objects. (e.g. Contact objects)
Tags:
Parameters:
method find_by [line 1159]
void find_by(
$method_name,
$parameters, [
$find_type = null])
|
|
Implement find_by_*() and =_* methods
Converts a method name beginning 'find_by_' or 'find_all_by_' into a query for rows matching the rest of the method name and the arguments to the function. The part of the method name after '_by' is parsed for columns and logical relationships (AND and OR) to match. For example, the call find_by_fname('Ben') is converted to SELECT * ... WHERE fname='Ben' and the call find_by_fname_and_lname('Ben','Dover') is converted to SELECT * ... WHERE fname='Ben' AND lname='Dover'
Tags:
Parameters:
method find_by_sql [line 1511]
void find_by_sql(
string
$sql)
|
|
Return all the rows selected by the SQL argument
If no rows match, an empty array is returned.
Parameters:
method find_first [line 1491]
mixed find_first(
[string
$conditions = null], [string
$order = null], [integer[]
$limit = 1], [string
$joins = null])
|
|
Return first row selected by $conditions
If no rows match, null is returned.
Tags:
Parameters:
method find_one_belongs_to [line 881]
void find_one_belongs_to(
$other_object_name, [
$parameters = null])
|
|
Find all records using a "belongs_to" relationship (one-to-one) (the foreign key being in the table itself) Parameters: $other_object_name: The singularized version of a table name.
E.g. If the Contact class belongs_to the Customer class, then $other_object_name will be "customer".
Tags:
Parameters:
method find_one_has_one [line 821]
void find_one_has_one(
$other_object_name, [
$parameters = null])
|
|
Find all records using a "has_one" relationship (one-to-one) (the foreign key being in the other table) Parameters: $other_table_name: The name of the other table that contains many rows relating to this object's id.
Returns: An array of ActiveRecord objects. (e.g. Contact objects)
Tags:
Parameters:
method get_association_type [line 1825]
mixed get_association_type(
$association_name)
|
|
returns the association type if defined in child class or null
Tags:
Parameters:
method get_attributes [line 2250]
Return pairs of column-name:column-value
Return the contents of the object as an array of elements where the key is the column name and the value is the column value. Relies on a previous call to set_content_columns() for information about the format of a row in the table.
Tags:
method get_class_name [line 2417]
Get class name of child object
this will return the manually set name or get_class($this)
Tags:
method get_composite_object [line 1773]
void get_composite_object(
$name)
|
|
Loads the model values into composite object
Tags:
Parameters:
method get_errors [line 3196]
mixed get_errors(
[boolean
$return_string = false], [string
$seperator = "<br>"])
|
|
Return description of non-fatal errors
Tags:
Parameters:
method get_errors_as_string [line 3213]
string get_errors_as_string(
[string
$seperator = "<br>"])
|
|
Return errors as a string.
Concatenate all error descriptions into a stringusing $seperator between elements and return the string.
Tags:
Parameters:
method get_error_message_for_validation [line 3128]
string get_error_message_for_validation(
string
$message, string
$key, [string
$value = null])
|
|
Return the error message for a validation function
Tags:
Parameters:
method get_inserts [line 2328]
Return column values for SQL insert statement
Return an array containing the column names and values of this object, filtering out the primary keys, which are not set.
Tags:
method get_insert_id [line 2465]
Returns the autogenerated id from the last insert query
Tags:
method get_join_table_name [line 995]
void get_join_table_name(
$first_table,
$second_table)
|
|
Returns a the name of the join table that would be used for the two tables. The join table name is decided from the alphabetical order of the two tables. e.g. "genres_movies" because "g" comes before "m"
Parameters: $first_table, $second_table: the names of two database tables, e.g. "movies" and "genres"
Tags:
Parameters:
method get_primary_key_conditions [line 2355]
string get_primary_key_conditions(
[
$operator = "="])
|
|
Return argument for a "WHERE" clause specifying this row
Returns a string which specifies the column(s) and value(s) which describe the primary key of this row of the associated table. The primary key must be one or more attributes of the object and must be listed in $content_columns as columns in the row.
Example: if $primary_keys = array("id", "ssn") and column "id" has value "5" and column "ssn" has value "123-45-6789" then the string "id = 5 AND ssn = '123-45-6789'" would be returned.
Tags:
Parameters:
method get_updates_sql [line 2381]
string get_updates_sql(
)
|
|
Return column values of object formatted for SQL update statement
Return a string containing the column names and values of this object in a format ready to be inserted in a SQL UPDATE statement. Automatic update has been applied to timestamps if enabled and characters special to SQL have been quoted.
Tags:
method is_composite [line 2577]
void is_composite(
string
$name)
|
|
Determine if passed in name is a composite class or not
Tags:
Parameters:
method is_error [line 3144]
boolean is_error(
object
$obj)
|
|
Test whether argument is a PEAR Error object or a MDB2 Error object.
Tags:
Parameters:
method is_new_record [line 1006]
Test whether this object represents a new record
Tags:
method load [line 1537]
void load(
[
$conditions = null])
|
|
Loads into current object values from the database.
Parameters:
method log_query [line 3223]
void log_query(
string
$query)
|
|
Log SQL query in development mode
If running in development mode, log the query to self::$query_log
Tags:
Parameters:
method query [line 1127]
$mdb2->query query(
string
$sql)
|
|
Perform an SQL query and return the results
Tags:
Parameters:
method quoted_attributes [line 2279]
string[] quoted_attributes(
[string[]
$attributes = null])
|
|
Return pairs of column-name:quoted-column-value
Return pairs of column-name:quoted-column-value where the key is the column name and the value is the column value with automatic timestamp updating applied and characters special to SQL quoted.
If $attributes is null or omitted, return all columns as currently stored in content_columns(). Otherwise, return the name:value pairs in $attributes.
Tags:
Parameters:
method quote_attribute [line 2294]
void quote_attribute(
$attribute, [
$value = null])
|
|
Quotes a single attribute for use in an sql statement.
Parameters:
method raise [line 3157]
Throw an exception describing an error in this object
Tags:
Parameters:
method reload [line 1520]
void reload(
[
$conditions = null])
|
|
Reloads the attributes of this object from the database.
Tags:
Parameters:
method rollback [line 1112]
Only used if you want to do transactions and your db supports transactions
Tags:
method save [line 1617]
boolean save(
[string[]
$attributes = null], [boolean
$dont_validate = false])
|
|
Create or update a row in the table with specified attributes
Tags:
Parameters:
method save_association [line 1893]
void save_association(
$object,
$type)
|
|
save the association to the database
Tags:
Parameters:
method save_associations [line 1871]
void save_associations(
)
|
|
Saves any associations objects assigned to this instance
Tags:
method save_without_validation [line 1596]
void save_without_validation(
[
$attributes = null])
|
|
Save without valdiating anything.
Tags:
Parameters:
method send [line 1071]
void send(
string
$column)
|
|
Get contents of one column of record selected by id and table
When called, $id identifies one record in the table identified by $table. Fetch from the database the contents of column $column of this record.
Tags:
Parameters:
method set_content_columns [line 2435]
void set_content_columns(
string
$table_name)
|
|
Populate object with information about the table it represents
Call DB_common::tableInfo() to get a description of the table and store it in $content_columns. Add a more human friendly name to the element for each column.
Tags:
Parameters:
method set_habtm_attributes [line 2000]
void set_habtm_attributes(
$attributes)
|
|
Tags:
Parameters:
method set_table_name_using_class_name [line 2404]
void set_table_name_using_class_name(
)
|
|
Set $table_name from the class name of this object
By convention, the name of the database table represented by this object is derived from the name of the class.
Tags:
method update [line 1560]
void update(
$id,
$attributes, [
$dont_validate = false])
|
|
Finds the record from the passed id, instantly saves it with the passed attributes (if the validation permits it). Returns true on success and false on error.
Tags:
Parameters:
method update_all [line 1582]
void update_all(
$updates, [
$conditions = null])
|
|
Updates all records with the SET-part of an SQL update statement in updates and returns an integer with the number of rows updates. A subset of the records can be selected by specifying conditions.
Example: $model->update_all("category = 'cooldude', approved = 1", "author = 'John'");
Tags:
Parameters:
method update_attributes [line 2150]
void update_attributes(
string[]
$attributes)
|
|
Update object attributes from list in argument
The elements of $attributes are parsed and assigned to attributes of the ActiveRecord object. Date/time fields are treated according to the The Trax Naming Convention.
Tags:
Parameters:
method update_composite_attributes [line 2223]
void update_composite_attributes(
)
|
|
If a composite object was specified via $composed_of, then its values mapped to the model will overwrite the models values.
method update_habtm_records [line 2023]
void update_habtm_records(
$this_foreign_value)
|
|
Tags:
Parameters:
method update_record [line 1744]
Update the row in the table described by this object
The primary key attributes must exist and have appropriate non-null values. If a column is listed in $content_columns but no attribute of that name exists, the column will be set to the null string ''.
Tags:
method valid [line 2608]
Runs validation routines for update or create
Tags:
method validate [line 2698]
Overwrite this method for validation checks on all saves and
use $this->errors[] = "My error message."; or for invalid attributes $this->errors['attribute'] = "Attribute is invalid.";
Tags:
method validates_acceptance_of [line 2897]
void validates_acceptance_of(
string|array
$attribute_names, [string
$message = null], [string
$accept = 1])
|
|
Validates that a checkbox is clicked.
eg. validates_acceptance_of('eula')
Parameters:
method validates_confirmation_of [line 2914]
void validates_confirmation_of(
string|array
$attribute_names, [string
$message = null])
|
|
Validates that a field has the same value as its corresponding confirmation field.
eg. validates_confirmation_of('password')
Parameters:
method validates_exclusion_of [line 2933]
void validates_exclusion_of(
string|array
$attribute_names, [mixed
$in = array()], [string
$message = null])
|
|
Validates that specified attributes are NOT in an array of elements.
eg. validates_exclusion_of('age, 'in' => array(13, 19))
Parameters:
method validates_format_of [line 2959]
void validates_format_of(
string|array
$attribute_names, string
$regex, [string
$message = null])
|
|
Validates that specified attributes matches a regular expression eg. validates_format_of('email', '/^(+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i')
Parameters:
method validates_inclusion_of [line 2979]
void validates_inclusion_of(
string|array
$attribute_names, [mixed
$in = array()], [string
$message = null])
|
|
Validates that specified attributes are in an array of elements.
eg. validates_inclusion_of('gender', array('m', 'f'))
Parameters:
method validates_length_of [line 3004]
void validates_length_of(
string|array
$attribute_names, [array
$options = array(
'too_short' => null, 'too_long' => null, 'wrong_length' => null, 'message' => null)])
|
|
Validates that specified attributes are of some length eg. validates_length_of('password', array('minimum' => 8))
Parameters:
method validates_numericality_of [line 3055]
void validates_numericality_of(
string|array
$attribute_names, [string
$message = null], [
$only_integer = false], [
$allow_null = false])
|
|
Validates that specified attributes are numbers eg. validates_numericality_of('value')
Parameters:
method validates_presence_of [line 3085]
void validates_presence_of(
string|array
$attribute_names, [string
$message = null])
|
|
Validates that specified attributes are not blank eg. validates_presence_of(array('firstname', 'lastname'))
Parameters:
method validates_uniqueness_of [line 3102]
void validates_uniqueness_of(
string|array
$attribute_names, [string
$message = null])
|
|
Validates that specified attributes are unique in the model database table eg. validates_uniqueness_of('username')
Parameters:
method validate_builtin [line 2815]
Validates any builtin validates_* functions defined as class variables in child model class.
eg. public $validates_presence_of = array( 'first_name' => array( 'message' => "is not optional.", 'on' => 'update' ), 'last_name' => null, 'password' => array( 'on' => 'create' ) );
Tags:
method validate_model_attributes [line 2658]
boolean validate_model_attributes(
)
|
|
Call every method named "validate_*()" where * is a column name
Find and call every method named "validate_something()" where "something" is the name of a column. The "validate_something()" functions are expected to return an array whose first element is true or false (indicating whether or not the validation succeeded), and whose second element is the error message to display if the first element is false.
Tags:
method validate_on_create [line 2704]
void validate_on_create(
)
|
|
Override this method for validation checks used only on creation.
Tags:
method validate_on_update [line 2710]
void validate_on_update(
)
|
|
Override this method for validation checks used only on updates.
Tags:
method __call [line 578]
void __call(
$method_name,
$parameters)
|
|
Override call() to dynamically call the database associations
Tags:
Parameters:
method __get [line 496]
Override get() if they do $model->some_association->field_name dynamically load the requested contents from the database.
Tags:
Parameters:
method __set [line 540]
void __set(
$key,
$value)
|
|
Store column value or description of the table format
If called with key 'table_name', $value is stored as the description of the table format in $content_columns. Any other key causes an object variable with the same name to be created and stored into. If the value of $key matches the name of a column in content_columns, the corresponding object variable becomes the content of the column in this row.
Tags:
Parameters: