My Secret Life as a Spaghetti Coder
home | about | contact | privacy statement
Model | View | Controller | Migration

cfrails.Model
Component Model

The base Model class, from which all models should be derived.

properties:
methods: after_insert, after_save, after_update, afterInsert, afterSave, afterUpdate, autoload_relationship, before_insert, before_save, before_update, beforeInsert, beforeSave, beforeUpdate, destroy, do_delete, do_insert, do_update, doDelete, doInsert, doUpdate, exec_query, execQuery, execute_query, executeQuery, find_all, find_by_id, findAll, findByID, get_columns_properties, get_human_name, get_table_name, getColumnsProperties, getTableName, init, save, set_human_name, set_priority


after_insert
public after_insert( )

Executed before the after_save() method, and after the insert. It is executed after successfully passing validation and of course, after the insert. It is not executed if validation failed.

Output: suppressed

after_save
public after_save ( )

Executed after the save, and after the after_insert() or after_update() methods. It is executed after successfully passing validation and of course, after the update or insert. It is not executed if validation failed.

Output: suppressed

after_update
public after_update ( )

Executed before the after_save() method, and after the update. It is executed after successfully passing validation and of course, after the update. It is not executed if validation failed.

Output: suppressed

afterInsert
public afterInsert ( )

Alias for after_insert().

Output: suppressed

afterSave
public afterSave ( )

Alias for after_save().

Output: suppressed

afterUpdate
public afterUpdate ( )

Alias for after_update()..

Output: suppressed

autoload_relationship
public autoload_relationship ( required columns, required table, required joinOn, joinType="inner" )

Output: suppressed
Parameters:
   columns: any, required, columns
   table: any, required, table
   joinOn: any, required, joinOn
   joinType: any, optional, joinType

before_insert
public before_insert ( )

Executed after the before_save() method, and before the insert. It is also executed before any validation takes place, in case something is needed to pass validation.

Output: suppressed

before_save
public before_save ( )

Executed before the save, and before the before_insert() or before_update() methods. It is also executed before any validation takes place, in case something is needed to pass validation.

Output: suppressed

before_update
public before_update ( )

Executed after the before_save() method, and before the update. It is also executed before any validation takes place, in case something is needed to pass validation.

Output: suppressed

beforeInsert
public beforeInsert ( )

Alias for before_insert().

Output: suppressed

beforeSave
public beforeSave ( )

Alias for before_save().

Output: suppressed

beforeUpdate
public beforeUpdate ( )

Alias for before_update()..

Output: suppressed

destroy
public destroy ( )

Deletes the record for the model's current ID.

Output: suppressed

do_delete
public do_delete ( )

Alias for destroy().

Output: suppressed

do_insert
public do_insert ( )

Alias for doInsert().

Output: suppressed

do_update
public do_update ( )

Alias for doUpdate().

Output: suppressed

doDelete
public doDelete ( )

Alias for destroy().

Output: suppressed

doInsert
public doInsert ( )

Inserts the model's current field values into the model's table. Returns a blank string upon success, or a · (alt-250) delimited list of errors otherwise.

Output: suppressed

doUpdate
public doUpdate ( )

Updates the model's record in the table with the model's current field values, assuming the id is valid. Returns a blank string upon success, or a · (alt-250) delimited list of errors otherwise.

Output: suppressed

exec_query
public exec_query ( required sqlQueryText )

Alias for execute_query.

Output: suppressed
Parameters:
   sqlQueryText: any, required, sqlQueryText - Any legal SQL statement

execQuery
public execQuery ( required sqlQueryText )

Alias for exec_query.

Output: suppressed
Parameters:
   sqlQueryText: any, required, sqlQueryText - Any legal SQL statement

execute_query
public execute_query ( required sqlQueryText )

As a convenience only, you can just send a sql statement here and it will be executed.

Output: suppressed
Parameters:
   sqlQueryText: any, required, sqlQueryText - Any legal SQL statement

executeQuery
public executeQuery ( required sqlQueryText )

Alias for exec_query.

Output: suppressed
Parameters:
   sqlQueryText: any, required, sqlQueryText - Any legal SQL statement

find_all
public find_all ( orderBy="", filter="" )

Finds all records of the model's type

Output: suppressed
Parameters:
   orderBy: any, optional, orderBy
   filter: any, optional, filter

find_by_id
public find_by_id ( required id )

Finds a record of this type given its ID.

Output: suppressed
Parameters:
   id: any, required, id - The ID of the record you want to find.

findAll
public findAll ( orderBy="" )

Alias for find_all

Output: suppressed
Parameters:
   orderBy: any, optional, orderBy

findByID
public findByID ( required id )

Alias for find_by_id

Output: suppressed
Parameters:
   id: any, required, id - The ID of the record you want to find.

get_columns_properties
public get_columns_properties ( string whichColumn="" )

Alias for getColumnsProperties().

Output: suppressed
Parameters:
   whichColumn: string, optional, whichColumn

get_human_name
public string get_human_name ( required string columnName )

Output: suppressed
Parameters:
   columnName: string, required, columnName

get_table_name
public get_table_name ( )

Alias for getTableName().

Output: suppressed

getColumnsProperties
public getColumnsProperties ( string whichColumn="" )

Returns a query containing the model's columns properties: name, type, is_nullable, max_length, default_value, and priority. The records returned are sorted in order of priority, ascending.

Output: suppressed
Parameters:
   whichColumn: string, optional, whichColumn - Optional argument is used to specify only one column to get this information for.

getTableName
public getTableName ( )

Output: suppressed

init
public init ( struct params="[runtime expression]" )

returns the properly instantiated derivative of Model

Output: suppressed
Parameters:
   params: struct, optional, params - A structure containing the values for the model's columns. It can contain more or less fields than the actual model - only those that match will be set.

save
public save ( )

If the id is set, updates the table with the values in the fields. Otherwise, it inserts them.

Output: suppressed

set_human_name
public set_human_name ( required string columnName, required string humanName )

Sets the human name of a column.

Output: suppressed
Parameters:
   columnName: string, required, columnName - The name of the column whose priority you want to set.
   humanName: string, required, humanName - The new human name the column should have.

set_priority
public set_priority ( required string columnName, required numeric priority )

Sets the priority of a column. Also increases each priority coming 'after' the value passed by one, to break any ties. In effect, this method 'inserts' the column into row specified.

Output: suppressed
Parameters:
   columnName: string, required, columnName - The name of the column whose priority you want to set.
   priority: numeric, required, priority - The new priority number the column should have.

Google
Web CodeOdor.com

Me
Picture of me

Topics
.NET (19)
AI/Machine Learning (14)
Answers To 100 Interview Questions (10)
Bioinformatics (2)
Business (1)
C and Cplusplus (6)
cfrails (22)
ColdFusion (78)
Customer Relations (15)
Databases (3)
DRY (18)
DSLs (11)
Future Tech (5)
Games (5)
Groovy/Grails (8)
Hardware (1)
IDEs (9)
Java (38)
JavaScript (4)
Linux (2)
Lisp (1)
Mac OS (4)
Management (15)
MediaServerX (1)
Miscellany (76)
OOAD (37)
Productivity (11)
Programming (168)
Programming Quotables (9)
Rails (31)
Ruby (67)
Save Your Job (58)
scriptaGulous (4)
Software Development Process (23)
TDD (41)
TDDing xorblog (6)
Tools (5)
Web Development (8)
Windows (1)
With (1)
YAGNI (10)

Resources
Agile Manifesto & Principles
Principles Of OOD
ColdFusion
CFUnit
Ruby
Ruby on Rails
JUnit



RSS 2.0: Full Post | Short Blurb
Subscribe by email:

Delivered by FeedBurner