The name of the property you want to add an error on.
message
string
Yes
The error message (such as "Please enter a correct name in the form field" for example).
name
string
No
A name to identify the error by (useful when you need to distinguish one error from another one set on the same object and you don't want to use the error message itself for that).
The error message (such as "Please enter a correct name in the form field" for example).
name
string
No
A name to identify the error by (useful when you need to distinguish one error from another one set on the same object and you don't want to use the error message itself for that).
Registers method(s) that should be called after a new object is created.
Name
Type
Required
Default
Description
methods
string
No
Method name or list of method names that should be called when this callback event occurs in an object's life cycle (can also be called with the method argument).
Registers method(s) that should be called after an object is deleted.
Name
Type
Required
Default
Description
methods
string
No
Method name or list of method names that should be called when this callback event occurs in an object's life cycle (can also be called with the method argument).
Registers method(s) that should be called after an existing object has been initialized (which is usually done with the findByKey or findOne method).
Name
Type
Required
Default
Description
methods
string
No
Method name or list of method names that should be called when this callback event occurs in an object's life cycle (can also be called with the method argument).
Registers method(s) that should be called after an object has been initialized.
Name
Type
Required
Default
Description
methods
string
No
Method name or list of method names that should be called when this callback event occurs in an object's life cycle (can also be called with the method argument).
Registers method(s) that should be called after a new object has been initialized (which is usually done with the new method).
Name
Type
Required
Default
Description
methods
string
No
Method name or list of method names that should be called when this callback event occurs in an object's life cycle (can also be called with the method argument).
Registers method(s) that should be called after an object is saved.
Name
Type
Required
Default
Description
methods
string
No
Method name or list of method names that should be called when this callback event occurs in an object's life cycle (can also be called with the method argument).
Registers method(s) that should be called after an existing object is updated.
Name
Type
Required
Default
Description
methods
string
No
Method name or list of method names that should be called when this callback event occurs in an object's life cycle (can also be called with the method argument).
Registers method(s) that should be called after an object is validated.
Name
Type
Required
Default
Description
methods
string
No
Method name or list of method names that should be called when this callback event occurs in an object's life cycle (can also be called with the method argument).
Registers method(s) that should be called after a new object is validated.
Name
Type
Required
Default
Description
methods
string
No
Method name or list of method names that should be called when this callback event occurs in an object's life cycle (can also be called with the method argument).
Registers method(s) that should be called after an existing object is validated.
Name
Type
Required
Default
Description
methods
string
No
Method name or list of method names that should be called when this callback event occurs in an object's life cycle (can also be called with the method argument).
Returns an array of all the errors on the object.
It does this by storing instances of models that are associations, and not checking associations of those instances because they have already been checked.
Name
Type
Required
Default
Description
includeAssociations
boolean
No
false
seenErrors
array
No
[runtime expression]
is a private argument not meant to be used by the user, the function uses this to ensure circular dependency avoidance.
Whether to link URLs, email addresses or both. Possible values are: all (default), URLs and emailAddresses.
relative
boolean
No
true
Should we auto-link relative urls.
encode
any
No
true
Use this argument to decide whether the output of the function should be encoded in order to prevent Cross Site Scripting (XSS) attacks. Set it to true to encode all relevant output for the specific HTML element in question (e.g. tag content, attribute values, and URLs). For HTML elements that have both tag content and attribute values you can set this argument to attributes to only encode attribute values and not tag content.
Calculates the average value for a given property.
Uses the SQL function AVG.
If no records can be found to perform the calculation on you can use the ifNull argument to decide what should be returned.
Name
Type
Required
Default
Description
property
string
Yes
Name of the property to calculate the average for.
where
string
No
Maps to the WHERE clause of the query (or HAVING when necessary). The following operators are supported: =, !=, <>, <, <=, >, >=, LIKE, NOT LIKE, IN, NOT IN, IS NULL, IS NOT NULL, AND, and OR (note that the key words need to be written in upper case). You can also use parentheses to group statements. Nested queries not allowed. You do not need to specify the table name(s); Wheels will do that for you.
include
string
No
Associations that should be included in the query using INNER or LEFT OUTER joins (which join type that is used depends on how the association has been set up in your model). If all included associations are set on the current model, you can specify them in a list (e.g. department,addresses,emails). You can build more complex include strings by using parentheses when the association is set on an included model, like album(artist(genre)), for example. These complex include strings only work when returnAs is set to query though.
distinct
boolean
No
false
When true, AVG will be performed only on each unique instance of a value, regardless of how many times the value occurs.
parameterize
any
No
true
Set to true to use cfqueryparam on all columns, or pass in a list of property names to use cfqueryparam on those only.
ifNull
any
No
The value returned if no records are found. Common usage is to set this to 0 to make sure a numeric value is always returned instead of a blank string.
includeSoftDeletes
boolean
No
false
Set to true to include soft-deleted records in the queries that this method runs.
group
string
No
Maps to the GROUP BY clause of the query. You do not need to specify the table name(s); Wheels will do that for you.
Registers method(s) that should be called before a new object is created.
Name
Type
Required
Default
Description
methods
string
No
Method name or list of method names that should be called when this callback event occurs in an object's life cycle (can also be called with the method argument).
Registers method(s) that should be called before an object is deleted.
Name
Type
Required
Default
Description
methods
string
No
Method name or list of method names that should be called when this callback event occurs in an object's life cycle (can also be called with the method argument).
Registers method(s) that should be called before an object is saved.
Name
Type
Required
Default
Description
methods
string
No
Method name or list of method names that should be called when this callback event occurs in an object's life cycle (can also be called with the method argument).
Registers method(s) that should be called before an existing object is updated.
Name
Type
Required
Default
Description
methods
string
No
Method name or list of method names that should be called when this callback event occurs in an object's life cycle (can also be called with the method argument).
Registers method(s) that should be called before an object is validated.
Name
Type
Required
Default
Description
methods
string
No
Method name or list of method names that should be called when this callback event occurs in an object's life cycle (can also be called with the method argument).
Registers method(s) that should be called before a new object is validated.
Name
Type
Required
Default
Description
methods
string
No
Method name or list of method names that should be called when this callback event occurs in an object's life cycle (can also be called with the method argument).
Registers method(s) that should be called before an existing object is validated.
Name
Type
Required
Default
Description
methods
string
No
Method name or list of method names that should be called when this callback event occurs in an object's life cycle (can also be called with the method argument).
Sets up a belongsTo association between this model and the specified one.
Use this association when this model contains a foreign key referencing another model.
Name
Type
Required
Default
Description
name
string
Yes
Gives the association a name that you refer to when working with the association (in the include argument to findAll, to name one example).
modelName
string
No
Name of associated model (usually not needed if you follow Wheels conventions because the model name will be deduced from the name argument).
foreignKey
string
No
Foreign key property name (usually not needed if you follow Wheels conventions since the foreign key name will be deduced from the name argument).
joinKey
string
No
Column name to join to if not the primary key (usually not needed if you follow Wheels conventions since the join key will be the table's primary key/keys).
joinType
string
No
inner
Use to set the join type when joining associated tables. Possible values are inner (for INNER JOIN) and outer (for LEFT OUTER JOIN).
Builds and returns a string containing a button form control.
Name
Type
Required
Default
Description
content
string
No
Save changes
Content to display inside the button.
type
string
No
submit
The type for the button: button, reset, or submit.
value
string
No
save
The value of the button when submitted.
image
string
No
File name of the image file to use in the button form control.
prepend
string
No
String to prepend to the form control. Useful to wrap the form control with HTML tags.
append
string
No
String to append to the form control. Useful to wrap the form control with HTML tags.
encode
any
No
true
Use this argument to decide whether the output of the function should be encoded in order to prevent Cross Site Scripting (XSS) attacks. Set it to true to encode all relevant output for the specific HTML element in question (e.g. tag content, attribute values, and URLs). For HTML elements that have both tag content and attribute values you can set this argument to attributes to only encode attribute values and not tag content.
Creates a form containing a single button that submits to the URL. Note: Pass any additional arguments by prefixing them with "input" like inputClass, inputRel, and inputId, and the generated tag will also include those values as HTML attributes.
The URL is built the same way as the linkTo function.
Name
Type
Required
Default
Description
text
string
No
The text content of the button.
image
string
No
If you want to use an image for the button pass in the link to it here (relative from the images folder).
route
string
No
Name of a route that you have configured in config/routes.cfm.
controller
string
No
Name of the controller to include in the URL.
action
string
No
Name of the action to include in the URL.
key
any
No
Key(s) to include in the URL.
params
string
No
Any additional parameters to be set in the query string (example: wheels=cool&x=y). Please note that Wheels uses the & and = characters to split the parameters and encode them properly for you. However, if you need to pass in & or = as part of the value, then you need to encode them (and only them), example: a=cats%26dogs%3Dtrouble!&b=1.
anchor
string
No
Sets an anchor name to be appended to the path.
method
string
No
The type of method to use in the form tag (delete, get, patch, post, and put are the options).
onlyPath
boolean
No
true
If true, returns only the relative URL (no protocol, host name or port).
host
string
No
Set this to override the current host.
protocol
string
No
Set this to override the current protocol.
port
numeric
No
0
Set this to override the current port number.
encode
any
No
true
Use this argument to decide whether the output of the function should be encoded in order to prevent Cross Site Scripting (XSS) attacks. Set it to true to encode all relevant output for the specific HTML element in question (e.g. tag content, attribute values, and URLs). For HTML elements that have both tag content and attribute values you can set this argument to attributes to only encode attribute values and not tag content.
Action(s) to cache. This argument is also aliased as actions.
time
numeric
No
60
Minutes to cache the action(s) for.
static
boolean
No
false
Set to true to tell Wheels that this is a static page and that it can skip running the controller filters (before and after filters set on actions). Please note that the onSessionStart and onRequestStart events still execute though.
appendToKey
string
No
List of variables to be evaluated at runtime and included in the cache key so that content can be cached separately.
Returns the previous value of a property that has changed.
Returns an empty string if no previous value exists.
Wheels will keep a note of the previous property value until the object is saved to the database.
Builds and returns a string containing a check box form control based on the supplied name.
Note: Pass any additional arguments like class, rel, and id, and the generated tag will also include those values as HTML attributes.
Name
Type
Required
Default
Description
objectName
any
Yes
The variable name of the object to build the form control for.
property
string
Yes
The name of the property to use in the form control.
association
string
No
The name of the association that the property is located on. Used for building nested forms that work with nested properties. If you are building a form with deep nesting, simply pass in a list to the nested object, and Wheels will figure it out.
position
string
No
The position used when referencing a hasMany relationship in the association argument. Used for building nested forms that work with nested properties. If you are building a form with deep nestings, simply pass in a list of positions, and Wheels will figure it out.
checkedValue
string
No
1
uncheckedValue
string
No
0
The value of the check box when it's on the unchecked state.
label
string
No
useDefaultLabel
The label text to use in the form control.
labelPlacement
string
No
around
Whether to place the label before, after, or wrapped around the form control. Label text placement can be controlled using aroundLeft or aroundRight.
prepend
string
No
String to prepend to the form control. Useful to wrap the form control with HTML tags.
append
string
No
String to append to the form control. Useful to wrap the form control with HTML tags.
prependToLabel
string
No
String to prepend to the form control's label. Useful to wrap the form control with HTML tags.
appendToLabel
string
No
String to append to the form control's label. Useful to wrap the form control with HTML tags.
errorElement
string
No
span
HTML tag to wrap the form control with when the object contains errors.
errorClass
string
No
field-with-errors
The class name of the HTML tag that wraps the form control when there are errors.
encode
any
No
true
Use this argument to decide whether the output of the function should be encoded in order to prevent Cross Site Scripting (XSS) attacks. Set it to true to encode all relevant output for the specific HTML element in question (e.g. tag content, attribute values, and URLs). For HTML elements that have both tag content and attribute values you can set this argument to attributes to only encode attribute values and not tag content.
Builds and returns a string containing a check box form control based on the supplied name.
Note: Pass any additional arguments like class, rel, and id, and the generated tag will also include those values as HTML attributes.
Name
Type
Required
Default
Description
name
string
Yes
Name to populate in tag's name attribute.
checked
boolean
No
false
Whether or not the check box should be checked by default.
value
string
No
1
Value of check box in its checked state.
uncheckedValue
string
No
The value of the check box when it's on the unchecked state.
label
string
No
The label text to use in the form control.
labelPlacement
string
No
around
Whether to place the label before, after, or wrapped around the form control. Label text placement can be controlled using aroundLeft or aroundRight.
prepend
string
No
String to prepend to the form control. Useful to wrap the form control with HTML tags.
append
string
No
String to append to the form control. Useful to wrap the form control with HTML tags.
prependToLabel
string
No
String to prepend to the form control's label. Useful to wrap the form control with HTML tags.
appendToLabel
string
No
String to append to the form control's label. Useful to wrap the form control with HTML tags.
encode
any
No
true
Use this argument to decide whether the output of the function should be encoded in order to prevent Cross Site Scripting (XSS) attacks. Set it to true to encode all relevant output for the specific HTML element in question (e.g. tag content, attribute values, and URLs). For HTML elements that have both tag content and attribute values you can set this argument to attributes to only encode attribute values and not tag content.
A collection route doesn't require an id because it acts on a collection of objects.
photos/search is an example of a collection route, because it acts on (and displays) a collection of objects.
Returns a list of column names in the table mapped to this model.
The list is ordered according to the columns' ordinal positions in the database table.
Returns an array of columns names for the table associated with this class.
Does not include calculated properties that will be generated by the Wheels ORM.
Used to store a section's output for rendering within a layout.
This content store acts as a stack, so you can store multiple pieces of content for a given section.
Name
Type
Required
Default
Description
position
any
No
last
The position in the section's stack where you want the content placed. Valid values are first, last, or the numeric position.
overwrite
any
No
false
Whether or not to overwrite any of the content. Valid values are false, true, or all.
Returns the number of rows that match the arguments (or all rows if no arguments are passed in).
Uses the SQL function COUNT.
If no records can be found to perform the calculation on, 0 is returned.
Name
Type
Required
Default
Description
where
string
No
Maps to the WHERE clause of the query (or HAVING when necessary). The following operators are supported: =, !=, <>, <, <=, >, >=, LIKE, NOT LIKE, IN, NOT IN, IS NULL, IS NOT NULL, AND, and OR (note that the key words need to be written in upper case). You can also use parentheses to group statements. Nested queries not allowed. You do not need to specify the table name(s); Wheels will do that for you.
include
string
No
Associations that should be included in the query using INNER or LEFT OUTER joins (which join type that is used depends on how the association has been set up in your model). If all included associations are set on the current model, you can specify them in a list (e.g. department,addresses,emails). You can build more complex include strings by using parentheses when the association is set on an included model, like album(artist(genre)), for example. These complex include strings only work when returnAs is set to query though.
parameterize
any
No
true
Set to true to use cfqueryparam on all columns, or pass in a list of property names to use cfqueryparam on those only.
includeSoftDeletes
boolean
No
false
Set to true to include soft-deleted records in the queries that this method runs.
group
string
No
Maps to the GROUP BY clause of the query. You do not need to specify the table name(s); Wheels will do that for you.
Creates a new object, saves it to the database (if the validation permits it), and returns it.
If the validation fails, the unsaved object (with errors added to it) is still returned.
Property names and values can be passed in either using named arguments or as a struct to the properties argument.
Name
Type
Required
Default
Description
properties
struct
No
[runtime expression]
The properties you want to set on the object (can also be passed in as named arguments).
parameterize
any
No
true
Set to true to use cfqueryparam on all columns, or pass in a list of property names to use cfqueryparam on those only.
reload
boolean
No
false
Set to true to force Wheels to query the database even though an identical query for this model may have been run in the same request. (The default in Wheels is to get the second query from the model's request-level cache.)
validate
boolean
No
true
Set to false to skip validations for this operation.
transaction
string
No
[runtime expression]
Set this to commit to update the database, rollback to run all the database queries but not commit them, or none to skip transaction handling altogether.
callbacks
boolean
No
true
Set to false to disable callbacks for this method.
allowExplicitTimestamps
boolean
No
false
Set this to true to allow explicit assignment of createdAt or updatedAt properties
Include this in your layouts' head sections to include meta tags containing the authenticity token for use by JavaScript AJAX requests needing to POST data to your application.
Builds and returns a string containing three select form controls for month, day, and year based on the supplied objectName and property.
Name
Type
Required
Default
Description
objectName
any
No
The variable name of the object to build the form control for.
property
string
No
The name of the property to use in the form control.
association
string
No
The name of the association that the property is located on. Used for building nested forms that work with nested properties. If you are building a form with deep nesting, simply pass in a list to the nested object, and Wheels will figure it out.
position
string
No
The position used when referencing a hasMany relationship in the association argument. Used for building nested forms that work with nested properties. If you are building a form with deep nestings, simply pass in a list of positions, and Wheels will figure it out.
order
string
No
month,day,year
Use to change the order of or exclude date select tags.
separator
string
No
Use to change the character that is displayed between the date select tags.
startYear
numeric
No
2021
First year in select list.
endYear
numeric
No
2031
Last year in select list.
monthDisplay
string
No
names
Pass in names, numbers, or abbreviations to control display.
Whether to include a blank option in the select form control. Pass true to include a blank line or a string that should represent what display text should appear for the empty value (for example, "- Select One -").
label
string
No
false
The label text to use in the form control.
labelPlacement
string
No
around
Whether to place the label before, after, or wrapped around the form control. Label text placement can be controlled using aroundLeft or aroundRight.
prepend
string
No
String to prepend to the form control. Useful to wrap the form control with HTML tags.
append
string
No
String to append to the form control. Useful to wrap the form control with HTML tags.
prependToLabel
string
No
String to prepend to the form control's label. Useful to wrap the form control with HTML tags.
appendToLabel
string
No
String to append to the form control's label. Useful to wrap the form control with HTML tags.
errorElement
string
No
span
HTML tag to wrap the form control with when the object contains errors.
errorClass
string
No
field-with-errors
The class name of the HTML tag that wraps the form control when there are errors.
combine
boolean
No
Set to false to not combine the select parts into a single DateTime object.
encode
any
No
true
Use this argument to decide whether the output of the function should be encoded in order to prevent Cross Site Scripting (XSS) attacks. Set it to true to encode all relevant output for the specific HTML element in question (e.g. tag content, attribute values, and URLs). For HTML elements that have both tag content and attribute values you can set this argument to attributes to only encode attribute values and not tag content.
Whether to include a blank option in the select form control. Pass true to include a blank line or a string that should represent what display text should appear for the empty value (for example, "- Select One -").
label
string
No
The label text to use in the form control.
labelPlacement
string
No
around
Whether to place the label before, after, or wrapped around the form control. Label text placement can be controlled using aroundLeft or aroundRight.
prepend
string
No
String to prepend to the form control. Useful to wrap the form control with HTML tags.
append
string
No
String to append to the form control. Useful to wrap the form control with HTML tags.
prependToLabel
string
No
String to prepend to the form control's label. Useful to wrap the form control with HTML tags.
appendToLabel
string
No
String to append to the form control's label. Useful to wrap the form control with HTML tags.
combine
boolean
No
Set to false to not combine the select parts into a single DateTime object.
encode
any
No
true
Use this argument to decide whether the output of the function should be encoded in order to prevent Cross Site Scripting (XSS) attacks. Set it to true to encode all relevant output for the specific HTML element in question (e.g. tag content, attribute values, and URLs). For HTML elements that have both tag content and attribute values you can set this argument to attributes to only encode attribute values and not tag content.
Builds and returns a string containing six select form controls (three for date selection and the remaining three for time selection) based on the supplied objectName and property.
Name
Type
Required
Default
Description
objectName
string
Yes
The variable name of the object to build the form control for.
property
string
Yes
The name of the property to use in the form control.
association
string
No
The name of the association that the property is located on. Used for building nested forms that work with nested properties. If you are building a form with deep nesting, simply pass in a list to the nested object, and Wheels will figure it out.
position
string
No
The position used when referencing a hasMany relationship in the association argument. Used for building nested forms that work with nested properties. If you are building a form with deep nestings, simply pass in a list of positions, and Wheels will figure it out.
dateOrder
string
No
month,day,year
Use to change the order of or exclude date select tags.
dateSeparator
string
No
Use to change the character that is displayed between the date select tags.
startYear
numeric
No
2021
Last year in select list.
endYear
numeric
No
2031
monthDisplay
string
No
names
Pass in names, numbers, or abbreviations to control display.
Use to change the order of or exclude time select tags.
timeSeparator
string
No
:
Use to change the character that is displayed between the time select tags.
minuteStep
numeric
No
1
Pass in 10 to only show minute 10, 20, 30, etc.
secondStep
numeric
No
1
Pass in 10 to only show seconds 10, 20, 30, etc
separator
string
No
-
Use to change the character that is displayed between the first and second set of select tags.
includeBlank
any
No
false
Whether to include a blank option in the select form control. Pass true to include a blank line or a string that should represent what display text should appear for the empty value (for example, "- Select One -").
label
string
No
false
The label text to use in the form control.
labelPlacement
string
No
around
Whether to place the label before, after, or wrapped around the form control. Label text placement can be controlled using aroundLeft or aroundRight.
prepend
string
No
String to prepend to the form control. Useful to wrap the form control with HTML tags.
append
string
No
String to append to the form control. Useful to wrap the form control with HTML tags.
prependToLabel
string
No
String to prepend to the form control's label. Useful to wrap the form control with HTML tags.
appendToLabel
string
No
String to append to the form control's label. Useful to wrap the form control with HTML tags.
errorElement
string
No
span
HTML tag to wrap the form control with when the object contains errors.
errorClass
string
No
field-with-errors
The class name of the HTML tag that wraps the form control when there are errors.
combine
boolean
No
Set to false to not combine the select parts into a single DateTime object.
twelveHour
boolean
No
false
Whether to display the hours in 24 or 12 hour format. 12 hour format has AM/PM drop downs
encode
any
No
true
Use this argument to decide whether the output of the function should be encoded in order to prevent Cross Site Scripting (XSS) attacks. Set it to true to encode all relevant output for the specific HTML element in question (e.g. tag content, attribute values, and URLs). For HTML elements that have both tag content and attribute values you can set this argument to attributes to only encode attribute values and not tag content.
Use to change the order of or exclude time select tags.
timeSeparator
string
No
:
Use to change the character that is displayed between the time select tags.
minuteStep
numeric
No
1
Pass in 10 to only show minute 10, 20, 30, etc.
secondStep
numeric
No
1
Pass in 10 to only show seconds 10, 20, 30, etc.
separator
string
No
-
Use to change the character that is displayed between the first and second set of select tags.
includeBlank
any
No
false
Whether to include a blank option in the select form control. Pass true to include a blank line or a string that should represent what display text should appear for the empty value (for example, "- Select One -").
label
string
No
The label text to use in the form control.
labelPlacement
string
No
around
Whether to place the label before, after, or wrapped around the form control. Label text placement can be controlled using aroundLeft or aroundRight.
prepend
string
No
String to prepend to the form control. Useful to wrap the form control with HTML tags.
append
string
No
String to append to the form control. Useful to wrap the form control with HTML tags.
prependToLabel
string
No
String to prepend to the form control's label. Useful to wrap the form control with HTML tags.
appendToLabel
string
No
String to append to the form control's label. Useful to wrap the form control with HTML tags.
combine
boolean
No
Set to false to not combine the select parts into a single DateTime object.
twelveHour
boolean
No
false
whether to display the hours in 24 or 12 hour format. 12 hour format has AM/PM drop downs
encode
any
No
true
Use this argument to decide whether the output of the function should be encoded in order to prevent Cross Site Scripting (XSS) attacks. Set it to true to encode all relevant output for the specific HTML element in question (e.g. tag content, attribute values, and URLs). For HTML elements that have both tag content and attribute values you can set this argument to attributes to only encode attribute values and not tag content.
Builds and returns a string containing a select form control for the days of the week based on the supplied name.
Name
Type
Required
Default
Description
name
string
Yes
Name to populate in tag's name attribute.
selected
string
No
The day that should be selected initially.
includeBlank
any
No
false
Whether to include a blank option in the select form control. Pass true to include a blank line or a string that should represent what display text should appear for the empty value (for example, "- Select One -").
label
string
No
The label text to use in the form control.
labelPlacement
string
No
around
Whether to place the label before, after, or wrapped around the form control. Label text placement can be controlled using aroundLeft or aroundRight.
prepend
string
No
String to prepend to the form control. Useful to wrap the form control with HTML tags.
append
string
No
String to append to the form control. Useful to wrap the form control with HTML tags.
prependToLabel
string
No
String to prepend to the form control's label. Useful to wrap the form control with HTML tags.
appendToLabel
string
No
String to append to the form control's label. Useful to wrap the form control with HTML tags.
encode
any
No
true
Use this argument to decide whether the output of the function should be encoded in order to prevent Cross Site Scripting (XSS) attacks. Set it to true to encode all relevant output for the specific HTML element in question (e.g. tag content, attribute values, and URLs). For HTML elements that have both tag content and attribute values you can set this argument to attributes to only encode attribute values and not tag content.
Used to examine an expression
Any overloaded arguments get passed to cfdump's attributeCollection
Name
Type
Required
Default
Description
expression
string
Yes
The expression to examine
display
boolean
No
true
Whether to display the debug call. False returns without outputting anything into the buffer. Good when you want to leave the debug command in the test for later purposes, but don't want it to display
Create a route that matches a URL requiring an HTTP DELETE method. We recommend using this matcher to expose actions that delete database records.
Name
Type
Required
Default
Description
name
string
No
Camel-case name of route to reference when build links and form actions (e.g., blogPost).
pattern
string
No
Overrides the URL pattern that will match the route. The default value is a dasherized version of name (e.g., a name of blogPost generates a pattern of blog-post).
to
string
No
Set controller##action combination to map the route to. You may use either this argument or a combination of controller and action.
controller
string
No
Map the route to a given controller. This must be passed along with the action argument.
action
string
No
Map the route to a given action within the controller. This must be passed along with the controller argument.
package
string
No
Indicates a subfolder that the controller will be referenced from (but not added to the URL pattern). For example, if you set this to admin, the controller will be located at admin/YourController.cfc, but the URL path will not contain admin/.
on
string
No
If this route is within a nested resource, you can set this argument to member or collection. A member route contains a reference to the resource's key, while a collection route does not.
redirect
string
No
Redirect via 302 to this URL when this route is matched. Has precedence over controller/action. Use either an absolute link like /about/, or a full canonical link.
Deletes the object, which means the row is deleted from the database (unless prevented by a beforeDelete callback).
Returns true on successful deletion of the row, false otherwise.
Name
Type
Required
Default
Description
parameterize
any
No
true
Set to true to use cfqueryparam on all columns, or pass in a list of property names to use cfqueryparam on those only.
transaction
string
No
[runtime expression]
Set this to commit to update the database, rollback to run all the database queries but not commit them, or none to skip transaction handling altogether.
callbacks
boolean
No
true
Set to false to disable callbacks for this method.
includeSoftDeletes
boolean
No
false
Set to true to include soft-deleted records in the queries that this method runs.
softDelete
boolean
No
true
Set to false to permanently delete a record, even if it has a soft delete column.
Deletes all records that match the where argument.
By default, objects will not be instantiated and therefore callbacks and validations are not invoked.
You can change this behavior by passing in instantiate=true.
Returns the number of records that were deleted.
Name
Type
Required
Default
Description
where
string
No
Maps to the WHERE clause of the query (or HAVING when necessary). The following operators are supported: =, !=, <>, <, <=, >, >=, LIKE, NOT LIKE, IN, NOT IN, IS NULL, IS NOT NULL, AND, and OR (note that the key words need to be written in upper case). You can also use parentheses to group statements. Nested queries not allowed. You do not need to specify the table name(s); Wheels will do that for you.
include
string
No
Associations that should be included in the query using INNER or LEFT OUTER joins (which join type that is used depends on how the association has been set up in your model). If all included associations are set on the current model, you can specify them in a list (e.g. department,addresses,emails). You can build more complex include strings by using parentheses when the association is set on an included model, like album(artist(genre)), for example. These complex include strings only work when returnAs is set to query though.
reload
boolean
No
false
Set to true to force Wheels to query the database even though an identical query for this model may have been run in the same request. (The default in Wheels is to get the second query from the model's request-level cache.)
parameterize
any
No
true
Set to true to use cfqueryparam on all columns, or pass in a list of property names to use cfqueryparam on those only.
instantiate
boolean
No
false
Whether or not to instantiate the object(s) first. When objects are not instantiated, any callbacks and validations set on them will be skipped.
useIndex
struct
No
[runtime expression]
If you want to specify table index hints, pass in a structure of index names using your model names as the structure keys. Eg: {user="idx_users", post="idx_posts"}. This feature is only supported by MySQL and SQL Server.
transaction
string
No
[runtime expression]
Set this to commit to update the database, rollback to run all the database queries but not commit them, or none to skip transaction handling altogether.
callbacks
boolean
No
true
Set to false to disable callbacks for this method.
includeSoftDeletes
boolean
No
false
Set to true to include soft-deleted records in the queries that this method runs.
softDelete
boolean
No
true
Set to false to permanently delete a record, even if it has a soft delete column.
Finds the record with the supplied key and deletes it.
Returns true on successful deletion of the row, false otherwise.
Name
Type
Required
Default
Description
key
any
Yes
Primary key value(s) of the record to fetch. Separate with comma if passing in multiple primary key values. Accepts a string, list, or a numeric value.
reload
boolean
No
false
Set to true to force Wheels to query the database even though an identical query for this model may have been run in the same request. (The default in Wheels is to get the second query from the model's request-level cache.)
transaction
string
No
[runtime expression]
Set this to commit to update the database, rollback to run all the database queries but not commit them, or none to skip transaction handling altogether.
callbacks
boolean
No
true
Set to false to disable callbacks for this method.
includeSoftDeletes
boolean
No
false
Set to true to include soft-deleted records in the queries that this method runs.
softDelete
boolean
No
true
Set to false to permanently delete a record, even if it has a soft delete column.
Gets an object based on conditions and deletes it.
Name
Type
Required
Default
Description
where
string
No
Maps to the WHERE clause of the query (or HAVING when necessary). The following operators are supported: =, !=, <>, <, <=, >, >=, LIKE, NOT LIKE, IN, NOT IN, IS NULL, IS NOT NULL, AND, and OR (note that the key words need to be written in upper case). You can also use parentheses to group statements. Nested queries not allowed. You do not need to specify the table name(s); Wheels will do that for you.
order
string
No
Maps to the ORDER BY clause of the query. You do not need to specify the table name(s); Wheels will do that for you.
reload
boolean
No
false
Set to true to force Wheels to query the database even though an identical query for this model may have been run in the same request. (The default in Wheels is to get the second query from the model's request-level cache.)
transaction
string
No
[runtime expression]
Set this to commit to update the database, rollback to run all the database queries but not commit them, or none to skip transaction handling altogether.
callbacks
boolean
No
true
Set to false to disable callbacks for this method.
includeSoftDeletes
boolean
No
false
Set to true to include soft-deleted records in the queries that this method runs.
useIndex
struct
No
[runtime expression]
If you want to specify table index hints, pass in a structure of index names using your model names as the structure keys. Eg: {user="idx_users", post="idx_posts"}. This feature is only supported by MySQL and SQL Server.
softDelete
boolean
No
true
Set to false to permanently delete a record, even if it has a soft delete column.
Migrates down: will be executed when migrating your schema backward
Along with up(), these are the two main functions in any migration file
Only available in a migration CFC
Call this to end a nested routing block or the entire route configuration. This method is chained on a sequence of routing mapper method calls started by mapper().
Builds and returns a string containing the closing form tag.
Name
Type
Required
Default
Description
prepend
string
No
String to prepend to the form control. Useful to wrap the form control with HTML tags.
append
string
No
String to append to the form control. Useful to wrap the form control with HTML tags.
encode
any
No
true
Use this argument to decide whether the output of the function should be encoded in order to prevent Cross Site Scripting (XSS) attacks. Set it to true to encode all relevant output for the specific HTML element in question (e.g. tag content, attribute values, and URLs). For HTML elements that have both tag content and attribute values you can set this argument to attributes to only encode attribute values and not tag content.
Returns the error message, if one exists, on the object's property.
If multiple error messages exist, the first one is returned.
Name
Type
Required
Default
Description
objectName
string
Yes
The variable name of the object to display the error message for.
property
string
Yes
The name of the property to display the error message for.
prependText
string
No
String to prepend to the error message.
appendText
string
No
String to append to the error message.
wrapperElement
string
No
span
HTML element to wrap the error message in.
class
string
No
error-message
CSS class to set on the wrapper element.
encode
boolean
No
true
Use this argument to decide whether the output of the function should be encoded in order to prevent Cross Site Scripting (XSS) attacks. Set it to true to encode all relevant output for the specific HTML element in question (e.g. tag content, attribute values, and URLs). For HTML elements that have both tag content and attribute values you can set this argument to attributes to only encode attribute values and not tag content.
Builds and returns a list (ul tag with a default class of error-messages) containing all the error messages for all the properties of the object.
Returns an empty string if no errors exist.
Name
Type
Required
Default
Description
objectName
string
Yes
The variable name of the object to display error messages for.
class
string
No
error-messages
CSS class to set on the ul element.
showDuplicates
boolean
No
true
Whether or not to show duplicate error messages.
encode
boolean
No
true
Use this argument to decide whether the output of the function should be encoded in order to prevent Cross Site Scripting (XSS) attacks. Set it to true to encode all relevant output for the specific HTML element in question (e.g. tag content, attribute values, and URLs). For HTML elements that have both tag content and attribute values you can set this argument to attributes to only encode attribute values and not tag content.
Checks if a record exists in the table.
You can pass in either a primary key value to the key argument or a string to the where argument.
If you don't pass in either of those, it will simply check if any record exists in the table.
Name
Type
Required
Default
Description
key
any
No
Primary key value(s) of the record. Separate with comma if passing in multiple primary key values. Accepts a string, list, or a numeric value.
where
string
No
Maps to the WHERE clause of the query (or HAVING when necessary). The following operators are supported: =, !=, <>, <, <=, >, >=, LIKE, NOT LIKE, IN, NOT IN, IS NULL, IS NOT NULL, AND, and OR (note that the key words need to be written in upper case). You can also use parentheses to group statements. Nested queries not allowed. You do not need to specify the table name(s); Wheels will do that for you.
reload
boolean
No
false
Set to true to force Wheels to query the database even though an identical query for this model may have been run in the same request. (The default in Wheels is to get the second query from the model's request-level cache.)
parameterize
any
No
true
Set to true to use cfqueryparam on all columns, or pass in a list of property names to use cfqueryparam on those only.
includeSoftDeletes
boolean
No
Set to true to include soft-deleted records in the queries that this method runs.
Builds and returns a string containing a file field form control based on the supplied objectName and property.
Note: Pass any additional arguments like class, rel, and id, and the generated tag will also include those values as HTML attributes.
Name
Type
Required
Default
Description
objectName
any
Yes
The variable name of the object to build the form control for.
property
string
Yes
The name of the property to use in the form control.
association
string
No
The name of the association that the property is located on. Used for building nested forms that work with nested properties. If you are building a form with deep nesting, simply pass in a list to the nested object, and Wheels will figure it out.
position
string
No
The position used when referencing a hasMany relationship in the association argument. Used for building nested forms that work with nested properties. If you are building a form with deep nestings, simply pass in a list of positions, and Wheels will figure it out.
label
string
No
useDefaultLabel
The label text to use in the form control.
labelPlacement
string
No
around
Whether to place the label before, after, or wrapped around the form control. Label text placement can be controlled using aroundLeft or aroundRight.
prepend
string
No
String to prepend to the form control. Useful to wrap the form control with HTML tags.
append
string
No
String to append to the form control. Useful to wrap the form control with HTML tags.
prependToLabel
string
No
String to prepend to the form control's label. Useful to wrap the form control with HTML tags.
appendToLabel
string
No
String to append to the form control's label. Useful to wrap the form control with HTML tags.
errorElement
string
No
span
HTML tag to wrap the form control with when the object contains errors.
errorClass
string
No
field-with-errors
The class name of the HTML tag that wraps the form control when there are errors.
encode
any
No
true
Use this argument to decide whether the output of the function should be encoded in order to prevent Cross Site Scripting (XSS) attacks. Set it to true to encode all relevant output for the specific HTML element in question (e.g. tag content, attribute values, and URLs). For HTML elements that have both tag content and attribute values you can set this argument to attributes to only encode attribute values and not tag content.
Builds and returns a string containing a file form control based on the supplied name.
Note: Pass any additional arguments like class, rel, and id, and the generated tag will also include those values as HTML attributes.
Name
Type
Required
Default
Description
name
string
Yes
Name to populate in tag's name attribute.
label
string
No
The label text to use in the form control.
labelPlacement
string
No
around
Whether to place the label before, after, or wrapped around the form control. Label text placement can be controlled using aroundLeft or aroundRight.
prepend
string
No
String to prepend to the form control. Useful to wrap the form control with HTML tags.
append
string
No
String to append to the form control. Useful to wrap the form control with HTML tags.
prependToLabel
string
No
String to prepend to the form control's label. Useful to wrap the form control with HTML tags.
appendToLabel
string
No
String to append to the form control's label. Useful to wrap the form control with HTML tags.
encode
any
No
true
Use this argument to decide whether the output of the function should be encoded in order to prevent Cross Site Scripting (XSS) attacks. Set it to true to encode all relevant output for the specific HTML element in question (e.g. tag content, attribute values, and URLs). For HTML elements that have both tag content and attribute values you can set this argument to attributes to only encode attribute values and not tag content.
Returns records from the database table mapped to this model according to the arguments passed in (use the where argument to decide which records to get, use the order argument to set the order in which those records should be returned, and so on).
The records will be returned as either a cfquery result set, an array of objects, or an array of structs (depending on what the returnAs argument is set to).
Name
Type
Required
Default
Description
where
string
No
Maps to the WHERE clause of the query (or HAVING when necessary). The following operators are supported: =, !=, <>, <, <=, >, >=, LIKE, NOT LIKE, IN, NOT IN, IS NULL, IS NOT NULL, AND, and OR (note that the key words need to be written in upper case). You can also use parentheses to group statements. Nested queries not allowed. You do not need to specify the table name(s); Wheels will do that for you.
order
string
No
Maps to the ORDER BY clause of the query. You do not need to specify the table name(s); Wheels will do that for you.
group
string
No
Maps to the GROUP BY clause of the query. You do not need to specify the table name(s); Wheels will do that for you.
select
string
No
Determines how the SELECT clause for the query used to return data will look. You can pass in a list of the properties (which map to columns) that you want returned from your table(s). If you don't set this argument at all, Wheels will select all properties from your table(s). If you specify a table name (e.g. users.email) or alias a column (e.g. fn AS firstName) in the list, then the entire list will be passed through unchanged and used in the SELECT clause of the query. By default, all column names in tables joined via the include argument will be prepended with the singular version of the included table name.
distinct
boolean
No
false
Whether to add the DISTINCT keyword to your SELECT clause. Wheels will, when necessary, add this automatically (when using pagination and a hasMany association is used in the include argument, to name one example).
include
string
No
Associations that should be included in the query using INNER or LEFT OUTER joins (which join type that is used depends on how the association has been set up in your model). If all included associations are set on the current model, you can specify them in a list (e.g. department,addresses,emails). You can build more complex include strings by using parentheses when the association is set on an included model, like album(artist(genre)), for example. These complex include strings only work when returnAs is set to query though.
maxRows
numeric
No
-1
Maximum number of records to retrieve. Passed on to the maxRowscfquery attribute. The default, -1, means that all records will be retrieved.
page
numeric
No
0
If you want to paginate records, you can do so by specifying a page number here. For example, getting records 11-20 would be page number 2 when perPage is kept at the default setting (10 records per page). The default, 0, means that records won't be paginated and that the perPage and count arguments will be ignored.
perPage
numeric
No
10
When using pagination, you can specify how many records you want to fetch per page here. This argument is only used when the page argument has been passed in.
count
numeric
No
0
When using pagination and you know in advance how many records you want to paginate through, you can pass in that value here. Doing so will prevent Wheels from running a COUNT query to get this value. This argument is only used when the page argument has been passed in.
handle
string
No
query
Handle to use for the query. This is used when you're paginating multiple queries and need to reference them individually in the paginationLinks() function. It's also used to set the name of the query in the debug output (which otherwise defaults to userFindAllQuery for example).
cache
any
No
If you want to cache the query, you can do so by specifying the number of minutes you want to cache the query for here. If you set it to true, the default cache time will be used (60 minutes).
reload
boolean
No
false
Set to true to force Wheels to query the database even though an identical query for this model may have been run in the same request. (The default in Wheels is to get the second query from the model's request-level cache.)
parameterize
any
No
true
Set to true to use cfqueryparam on all columns, or pass in a list of property names to use cfqueryparam on those only.
returnAs
string
No
query
Set to objects to return an array of objects, set to structs to return an array of structs, set to query to return a query result set, or set to 'sql' to return the executed SQL query as a string.
returnIncluded
boolean
No
true
When returnAs is set to objects, you can set this argument to false to prevent returning objects fetched from associations specified in the include argument. This is useful when you only need to include associations for use in the WHERE clause only and want to avoid the performance hit that comes with object creation.
callbacks
boolean
No
true
Set to false to disable callbacks for this method.
includeSoftDeletes
boolean
No
false
Set to true to include soft-deleted records in the queries that this method runs.
useIndex
struct
No
[runtime expression]
If you want to specify table index hints, pass in a structure of index names using your model names as the structure keys. Eg: {user="idx_users", post="idx_posts"}. This feature is only supported by MySQL and SQL Server.
Fetches the requested record by primary key and returns it as an object.
Returns false if no record is found.
You can override this behavior to return a cfquery result set instead, similar to what's described in the documentation for findOne().
Name
Type
Required
Default
Description
key
any
Yes
Primary key value(s) of the record. Separate with comma if passing in multiple primary key values. Accepts a string, list, or a numeric value.
select
string
No
Determines how the SELECT clause for the query used to return data will look. You can pass in a list of the properties (which map to columns) that you want returned from your table(s). If you don't set this argument at all, Wheels will select all properties from your table(s). If you specify a table name (e.g. users.email) or alias a column (e.g. fn AS firstName) in the list, then the entire list will be passed through unchanged and used in the SELECT clause of the query. By default, all column names in tables joined via the include argument will be prepended with the singular version of the included table name.
include
string
No
Associations that should be included in the query using INNER or LEFT OUTER joins (which join type that is used depends on how the association has been set up in your model). If all included associations are set on the current model, you can specify them in a list (e.g. department,addresses,emails). You can build more complex include strings by using parentheses when the association is set on an included model, like album(artist(genre)), for example. These complex include strings only work when returnAs is set to query though.
handle
string
No
query
Handle to use for the query. This is used to set the name of the query in the debug output (which otherwise defaults to userFindOneQuery for example).
cache
any
No
If you want to cache the query, you can do so by specifying the number of minutes you want to cache the query for here. If you set it to true, the default cache time will be used (60 minutes).
reload
boolean
No
false
Set to true to force Wheels to query the database even though an identical query for this model may have been run in the same request. (The default in Wheels is to get the second query from the model's request-level cache.)
parameterize
any
No
true
Set to true to use cfqueryparam on all columns, or pass in a list of property names to use cfqueryparam on those only.
returnAs
string
No
object
Set to objects to return an array of objects, set to structs to return an array of structs, set to query to return a query result set, or set to 'sql' to return the executed SQL query as a string.
callbacks
boolean
No
true
Set to false to disable callbacks for this method.
includeSoftDeletes
boolean
No
false
Set to true to include soft-deleted records in the queries that this method runs.
Fetches the last record ordered by primary key value.
Use the property argument to order by something else.
Returns a model object. Formerly known as findLast.
Name
Type
Required
Default
Description
property
string
No
Name of the property to order by. This argument is also aliased as properties.
Fetches the first record found based on the WHERE and ORDER BY clauses.
With the default settings (i.e. the returnAs argument set to object), a model object will be returned if the record is found and the boolean value false if not.
Instead of using the where argument, you can create cleaner code by making use of a concept called Dynamic Finders.
Name
Type
Required
Default
Description
where
string
No
Maps to the WHERE clause of the query (or HAVING when necessary). The following operators are supported: =, !=, <>, <, <=, >, >=, LIKE, NOT LIKE, IN, NOT IN, IS NULL, IS NOT NULL, AND, and OR (note that the key words need to be written in upper case). You can also use parentheses to group statements. Nested queries not allowed. You do not need to specify the table name(s); Wheels will do that for you.
order
string
No
Maps to the ORDER BY clause of the query. You do not need to specify the table name(s); Wheels will do that for you.
select
string
No
Determines how the SELECT clause for the query used to return data will look. You can pass in a list of the properties (which map to columns) that you want returned from your table(s). If you don't set this argument at all, Wheels will select all properties from your table(s). If you specify a table name (e.g. users.email) or alias a column (e.g. fn AS firstName) in the list, then the entire list will be passed through unchanged and used in the SELECT clause of the query. By default, all column names in tables joined via the include argument will be prepended with the singular version of the included table name.
include
string
No
Associations that should be included in the query using INNER or LEFT OUTER joins (which join type that is used depends on how the association has been set up in your model). If all included associations are set on the current model, you can specify them in a list (e.g. department,addresses,emails). You can build more complex include strings by using parentheses when the association is set on an included model, like album(artist(genre)), for example. These complex include strings only work when returnAs is set to query though.
handle
string
No
query
Handle to use for the query. This is used to set the name of the query in the debug output (which otherwise defaults to userFindOneQuery for example).
cache
any
No
If you want to cache the query, you can do so by specifying the number of minutes you want to cache the query for here. If you set it to true, the default cache time will be used (60 minutes).
reload
boolean
No
false
Set to true to force Wheels to query the database even though an identical query for this model may have been run in the same request. (The default in Wheels is to get the second query from the model's request-level cache.)
parameterize
any
No
true
Set to true to use cfqueryparam on all columns, or pass in a list of property names to use cfqueryparam on those only.
returnAs
string
No
object
Set to objects to return an array of objects, set to structs to return an array of structs, set to query to return a query result set, or set to 'sql' to return the executed SQL query as a string.
includeSoftDeletes
boolean
No
false
Set to true to include soft-deleted records in the queries that this method runs.
useIndex
struct
No
[runtime expression]
If you want to specify table index hints, pass in a structure of index names using your model names as the structure keys. Eg: {user="idx_users", post="idx_posts"}. This feature is only supported by MySQL and SQL Server.
Displays a marked-up listing of messages that exist in the Flash.
Name
Type
Required
Default
Description
keys
string
No
The key (or list of keys) to show the value for. You can also use the key argument instead for better readability when accessing a single key.
class
string
No
flash-messages
HTML class to set on the div element that contains the messages.
includeEmptyContainer
boolean
No
false
Includes the div container even if the Flash is empty.
encode
boolean
No
true
Use this argument to decide whether the output of the function should be encoded in order to prevent Cross Site Scripting (XSS) attacks. Set it to true to encode all relevant output for the specific HTML element in question (e.g. tag content, attribute values, and URLs). For HTML elements that have both tag content and attribute values you can set this argument to attributes to only encode attribute values and not tag content.
Create a route that matches a URL requiring an HTTP GET method. We recommend only using this matcher to expose actions that display data. See post, patch, delete, and put for matchers that are appropriate for actions that change data in your database.
Name
Type
Required
Default
Description
name
string
No
Camel-case name of route to reference when build links and form actions (e.g., blogPost).
pattern
string
No
Overrides the URL pattern that will match the route. The default value is a dasherized version of name (e.g., a name of blogPost generates a pattern of blog-post).
to
string
No
Set controller##action combination to map the route to. You may use either this argument or a combination of controller and action.
controller
string
No
Map the route to a given controller. This must be passed along with the action argument.
action
string
No
Map the route to a given action within the controller. This must be passed along with the controller argument.
package
string
No
Indicates a subfolder that the controller will be referenced from (but not added to the URL pattern). For example, if you set this to admin, the controller will be located at admin/YourController.cfc, but the URL path will not contain admin/.
on
string
No
If this route is within a nested resource, you can set this argument to member or collection. A member route contains a reference to the resource's key, while a collection route does not.
redirect
string
No
Redirect via 302 to this URL when this route is matched. Has precedence over controller/action. Use either an absolute link like /about/, or a full canonical link.
Searches db/migrate folder for migrations. Whilst you can use this in your application, the recommended usage is via either the CLI or the provided GUI interface
Name
Type
Required
Default
Description
path
string
No
[runtime expression]
Path to Migration Files: defaults to /app/migrator/migrations/
Returns current database version. Whilst you can use this in your application, the recommended usage is via either the CLI or the provided GUI interface
Returns true if the specified property (or any if none was passed in) has been changed but not yet saved to the database.
Will also return true if the object is new and no record for it exists in the database.
Sets up a hasMany association between this model and the specified one.
Name
Type
Required
Default
Description
name
string
Yes
Gives the association a name that you refer to when working with the association (in the include argument to findAll, to name one example).
modelName
string
No
Name of associated model (usually not needed if you follow Wheels conventions because the model name will be deduced from the name argument).
foreignKey
string
No
Foreign key property name (usually not needed if you follow Wheels conventions since the foreign key name will be deduced from the name argument).
joinKey
string
No
Column name to join to if not the primary key (usually not needed if you follow Wheels conventions since the join key will be the table's primary key/keys).
joinType
string
No
outer
Use to set the join type when joining associated tables. Possible values are inner (for INNER JOIN) and outer (for LEFT OUTER JOIN).
dependent
string
No
false
Defines how to handle dependent model objects when you delete an object from this model. delete / deleteAll deletes the record(s) (deleteAll bypasses object instantiation). remove / removeAll sets the forein key field(s) to NULL (removeAll bypasses object instantiation).
shortcut
string
No
Set this argument to create an additional dynamic method that gets the object(s) from the other side of a many-to-many association.
through
string
No
[runtime expression]
Set this argument if you need to override Wheels conventions when using the shortcut argument. Accepts a list of two association names representing the chain from the opposite side of the many-to-many relationship to this model.
Used as a shortcut to output the proper form elements for an association.
Note: Pass any additional arguments like class, rel, and id, and the generated tag will also include those values as HTML attributes.
Name
Type
Required
Default
Description
objectName
string
Yes
Name of the variable containing the parent object to represent with this form field.
association
string
Yes
Name of the association set in the parent object to represent with this form field.
keys
string
Yes
Primary keys associated with this form field. Note that these keys should be listed in the order that they appear in the database table.
label
string
No
The label text to use in the form control.
labelPlacement
string
No
Whether to place the label before, after, or wrapped around the form control. Label text placement can be controlled using aroundLeft or aroundRight.
prepend
string
No
String to prepend to the form control. Useful to wrap the form control with HTML tags.
append
string
No
String to append to the form control. Useful to wrap the form control with HTML tags.
prependToLabel
string
No
String to prepend to the form control's label. Useful to wrap the form control with HTML tags.
appendToLabel
string
No
String to append to the form control's label. Useful to wrap the form control with HTML tags.
errorElement
string
No
HTML tag to wrap the form control with when the object contains errors.
errorClass
string
No
The class name of the HTML tag that wraps the form control when there are errors.
encode
any
No
true
Use this argument to decide whether the output of the function should be encoded in order to prevent Cross Site Scripting (XSS) attacks. Set it to true to encode all relevant output for the specific HTML element in question (e.g. tag content, attribute values, and URLs). For HTML elements that have both tag content and attribute values you can set this argument to attributes to only encode attribute values and not tag content.
id
string
No
Optional. Explicit ID for the generated checkbox input. If not provided, an ID will be generated automatically.
Used as a shortcut to output the proper form elements for an association.
Note: Pass any additional arguments like class, rel, and id, and the generated tag will also include those values as HTML attributes.
Name
Type
Required
Default
Description
objectName
string
Yes
Name of the variable containing the parent object to represent with this form field.
association
string
Yes
Name of the association set in the parent object to represent with this form field.
property
string
Yes
Name of the property in the child object to represent with this form field.
keys
string
Yes
Primary keys associated with this form field. Note that these keys should be listed in the order that they appear in the database table.
tagValue
string
Yes
The value of the radio button when selected.
checkIfBlank
boolean
No
false
Whether or not to check this form field as a default if there is a blank value set for the property.
label
string
No
The label text to use in the form control.
encode
any
No
true
Use this argument to decide whether the output of the function should be encoded in order to prevent Cross Site Scripting (XSS) attacks. Set it to true to encode all relevant output for the specific HTML element in question (e.g. tag content, attribute values, and URLs). For HTML elements that have both tag content and attribute values you can set this argument to attributes to only encode attribute values and not tag content.
Sets up a hasOne association between this model and the specified one.
Name
Type
Required
Default
Description
name
string
Yes
Gives the association a name that you refer to when working with the association (in the include argument to findAll, to name one example).
modelName
string
No
Name of associated model (usually not needed if you follow Wheels conventions because the model name will be deduced from the name argument).
foreignKey
string
No
Foreign key property name (usually not needed if you follow Wheels conventions since the foreign key name will be deduced from the name argument).
joinKey
string
No
Column name to join to if not the primary key (usually not needed if you follow Wheels conventions since the join key will be the table's primary key/keys).
joinType
string
No
outer
Use to set the join type when joining associated tables. Possible values are inner (for INNER JOIN) and outer (for LEFT OUTER JOIN).
dependent
string
No
false
Defines how to handle dependent model objects when you delete an object from this model. delete / deleteAll deletes the record(s) (deleteAll bypasses object instantiation). remove / removeAll sets the forein key field(s) to NULL (removeAll bypasses object instantiation).
Builds and returns a string containing a hidden field form control based on the supplied objectName and property.
Note: Pass any additional arguments like class, rel, and id, and the generated tag will also include those values as HTML attributes.
Name
Type
Required
Default
Description
objectName
any
Yes
The variable name of the object to build the form control for.
property
string
Yes
The name of the property to use in the form control.
association
string
No
The name of the association that the property is located on. Used for building nested forms that work with nested properties. If you are building a form with deep nesting, simply pass in a list to the nested object, and Wheels will figure it out.
position
string
No
The position used when referencing a hasMany relationship in the association argument. Used for building nested forms that work with nested properties. If you are building a form with deep nestings, simply pass in a list of positions, and Wheels will figure it out.
encode
boolean
No
true
Use this argument to decide whether the output of the function should be encoded in order to prevent Cross Site Scripting (XSS) attacks. Set it to true to encode all relevant output for the specific HTML element in question (e.g. tag content, attribute values, and URLs). For HTML elements that have both tag content and attribute values you can set this argument to attributes to only encode attribute values and not tag content.
Builds and returns a string containing a hidden field form control based on the supplied name.
Note: Pass any additional arguments like class, rel, and id, and the generated tag will also include those values as HTML attributes.
Name
Type
Required
Default
Description
name
string
Yes
Name to populate in tag's name attribute.
value
string
No
Value to populate in tag's value attribute.
encode
boolean
No
true
Use this argument to decide whether the output of the function should be encoded in order to prevent Cross Site Scripting (XSS) attacks. Set it to true to encode all relevant output for the specific HTML element in question (e.g. tag content, attribute values, and URLs). For HTML elements that have both tag content and attribute values you can set this argument to attributes to only encode attribute values and not tag content.
Highlights the phrase(s) everywhere in the text if found by wrapping them in span tags.
Name
Type
Required
Default
Description
text
string
Yes
Text to search in.
phrase
string
No
Phrase (or list of phrases) to highlight. This argument is also aliased as phrases.
delimiter
string
No
,
Delimiter to use when passing in multiple phrases.
tag
string
No
span
HTML tag to use to wrap the highlighted phrase(s).
class
string
No
highlight
Class to use in the tags wrapping highlighted phrase(s).
encode
boolean
No
true
Use this argument to decide whether the output of the function should be encoded in order to prevent Cross Site Scripting (XSS) attacks. Set it to true to encode all relevant output for the specific HTML element in question (e.g. tag content, attribute values, and URLs). For HTML elements that have both tag content and attribute values you can set this argument to attributes to only encode attribute values and not tag content.
Builds and returns a string containing one select form control for the hours of the day based on the supplied name.
Name
Type
Required
Default
Description
name
string
Yes
Name to populate in tag's name attribute.
selected
string
No
The day that should be selected initially.
includeBlank
any
No
false
Whether to include a blank option in the select form control. Pass true to include a blank line or a string that should represent what display text should appear for the empty value (for example, "- Select One -").
label
string
No
The label text to use in the form control.
labelPlacement
string
No
around
Whether to place the label before, after, or wrapped around the form control. Label text placement can be controlled using aroundLeft or aroundRight.
prepend
string
No
String to prepend to the form control. Useful to wrap the form control with HTML tags.
append
string
No
String to append to the form control. Useful to wrap the form control with HTML tags.
prependToLabel
string
No
String to prepend to the form control's label. Useful to wrap the form control with HTML tags.
appendToLabel
string
No
String to append to the form control's label. Useful to wrap the form control with HTML tags.
twelveHour
boolean
No
false
whether to display the hours in 24 or 12 hour format. 12 hour format has AM/PM drop downs
encode
any
No
true
Use this argument to decide whether the output of the function should be encoded in order to prevent Cross Site Scripting (XSS) attacks. Set it to true to encode all relevant output for the specific HTML element in question (e.g. tag content, attribute values, and URLs). For HTML elements that have both tag content and attribute values you can set this argument to attributes to only encode attribute values and not tag content.
Returns an img tag.
If the image is stored in the local images folder, the tag will also set the width, height, and alt attributes for you.
You can pass any additional arguments (e.g. class, rel, id), and the generated tag will also include those values as HTML attributes.
Name
Type
Required
Default
Description
source
string
Yes
The file name of the image if it's available in the local file system (i.e. ColdFusion will be able to access it). Provide the full URL if the image is on a remote server.
onlyPath
boolean
No
true
host
string
No
protocol
string
No
port
numeric
No
0
encode
boolean
No
true
Use this argument to decide whether the output of the function should be encoded in order to prevent Cross Site Scripting (XSS) attacks. Set it to true to encode all relevant output for the specific HTML element in question (e.g. tag content, attribute values, and URLs). For HTML elements that have both tag content and attribute values you can set this argument to attributes to only encode attribute values and not tag content.
Includes the specified partial file in the view.
Similar to using cfinclude but with the ability to cache the result and use Wheels-specific file look-up.
By default, Wheels will look for the file in the current controller's view folder.
To include a file relative from the base views folder, you can start the path supplied to partial with a forward slash.
Name
Type
Required
Default
Description
partial
any
Yes
The name of the partial file to be used. Prefix with a leading slash (/) if you need to build a path from the root views folder. Do not include the partial filename's underscore and file extension. If you want to have Wheels display the partial for a single model object, array of model objects, or a query, pass a variable containing that data into this argument.
group
string
No
If passing a query result set for the partial argument, use this to specify the field to group the query by. A new query will be passed into the partial template for you to iterate over.
cache
any
No
Number of minutes to cache the content for.
layout
string
No
The layout to wrap the content in. Prefix with a leading slash (/) if you need to build a path from the root views folder. Pass false to not load a layout at all.
spacer
string
No
HTML or string to place between partials when called using a query.
Runs the specified method within a single database transaction.
Name
Type
Required
Default
Description
method
string
Yes
Model method to run.
transaction
string
No
commit
Set this to commit to update the database, rollback to run all the database queries but not commit them, or none to skip transaction handling altogether.
isolation
string
No
read_committed
Isolation level to be passed through to the cftransaction tag. See your CFML engine's documentation for more details about cftransaction's isolation attribute.
Returns true if this object has been persisted to the database or was loaded from the database via a finder.
Returns false if the record has not been persisted to the database.
Returns a script tag for a JavaScript file (or several) based on the supplied arguments.
Name
Type
Required
Default
Description
sources
string
No
The name of one or many JavaScript files in the javascripts folder, minus the .js extension. Pass a full URL to access an external JavaScript file. Can also be called with the source argument.
type
string
No
text/javascript
The type attribute for the script tag.
head
boolean
No
false
Set to true to place the output in the head area of the HTML page instead of the default behavior (which is to place the output where the function is called from).
delim
string
No
,
The delimiter to use for the list of JavaScript files.
encode
boolean
No
true
Use this argument to decide whether the output of the function should be encoded in order to prevent Cross Site Scripting (XSS) attacks. Set it to true to encode all relevant output for the specific HTML element in question (e.g. tag content, attribute values, and URLs). For HTML elements that have both tag content and attribute values you can set this argument to attributes to only encode attribute values and not tag content.
Returns the value of the primary key for the object.
If you have a single primary key named id, then someObject.key() is functionally equivalent to someObject.id.
This method is more useful when you do dynamic programming and don't know the name of the primary key or when you use composite keys (in which case it's convenient to use this method to get a list of both key values returned).
Creates a link to another page in your application.
Pass in the name of a route to use your configured routes or a controller/action/key combination.
Note: Pass any additional arguments like class, rel, and id, and the generated tag will also include those values as HTML attributes.
Name
Type
Required
Default
Description
text
string
No
The text content of the link.
route
string
No
Name of a route that you have configured in config/routes.cfm.
controller
string
No
Name of the controller to include in the URL.
action
string
No
Name of the action to include in the URL.
key
any
No
Key(s) to include in the URL.
params
string
No
Any additional parameters to be set in the query string (example: wheels=cool&x=y). Please note that Wheels uses the & and = characters to split the parameters and encode them properly for you. However, if you need to pass in & or = as part of the value, then you need to encode them (and only them), example: a=cats%26dogs%3Dtrouble!&b=1.
anchor
string
No
Sets an anchor name to be appended to the path.
onlyPath
boolean
No
true
If true, returns only the relative URL (no protocol, host name or port).
host
string
No
Set this to override the current host.
protocol
string
No
Set this to override the current protocol.
port
numeric
No
0
Set this to override the current port number.
href
string
No
Pass a link to an external site here if you want to bypass the Wheels routing system altogether and link to an external URL.
encode
any
No
true
Use this argument to decide whether the output of the function should be encoded in order to prevent Cross Site Scripting (XSS) attacks. Set it to true to encode all relevant output for the specific HTML element in question (e.g. tag content, attribute values, and URLs). For HTML elements that have both tag content and attribute values you can set this argument to attributes to only encode attribute values and not tag content.
Creates a mailto link tag to the specified email address, which is also used as the name of the link unless name is specified.
Name
Type
Required
Default
Description
emailAddress
string
Yes
The email address to link to.
name
string
No
A string to use as the link text ("Joe" or "Support Department", for example).
encode
any
No
true
Use this argument to decide whether the output of the function should be encoded in order to prevent Cross Site Scripting (XSS) attacks. Set it to true to encode all relevant output for the specific HTML element in question (e.g. tag content, attribute values, and URLs). For HTML elements that have both tag content and attribute values you can set this argument to attributes to only encode attribute values and not tag content.
mapper()
Configuration
Routing struct
controller
model
test
mapper
migrator
migration
tabledefinition
Returns the mapper object used to configure your application's routes. Usually you will use this method in config/routes.cfm to start chaining route mapping methods like resources, namespace, etc.
Name
Type
Required
Default
Description
restful
boolean
No
true
Whether to turn on RESTful routing or not. Not recommended to set. Will probably be removed in a future version of wheels, as RESTful routes are the default.
methods
boolean
No
[runtime expression]
If not RESTful, then specify allowed routes. Not recommended to set. Will probably be removed in a future version of wheels, as RESTful routes are the default.
mapFormat
boolean
No
true
This is useful for providing formats via URL like json, xml, pdf, etc. Set to false to disable automatic .[format] generation for resource based routes
Calculates the maximum value for a given property.
Uses the SQL function MAX.
If no records can be found to perform the calculation on you can use the ifNull argument to decide what should be returned.
Name
Type
Required
Default
Description
property
string
Yes
Name of the property to get the highest value for (must be a property of a numeric data type).
where
string
No
Maps to the WHERE clause of the query (or HAVING when necessary). The following operators are supported: =, !=, <>, <, <=, >, >=, LIKE, NOT LIKE, IN, NOT IN, IS NULL, IS NOT NULL, AND, and OR (note that the key words need to be written in upper case). You can also use parentheses to group statements. Nested queries not allowed. You do not need to specify the table name(s); Wheels will do that for you.
include
string
No
Associations that should be included in the query using INNER or LEFT OUTER joins (which join type that is used depends on how the association has been set up in your model). If all included associations are set on the current model, you can specify them in a list (e.g. department,addresses,emails). You can build more complex include strings by using parentheses when the association is set on an included model, like album(artist(genre)), for example. These complex include strings only work when returnAs is set to query though.
parameterize
any
No
true
ifNull
any
No
The value returned if no records are found. Common usage is to set this to 0 to make sure a numeric value is always returned instead of a blank string.
includeSoftDeletes
boolean
No
false
Set to true to include soft-deleted records in the queries that this method runs.
group
string
No
Maps to the GROUP BY clause of the query. You do not need to specify the table name(s); Wheels will do that for you.
Scope routes within a nested resource which require use of the primary key as part of the URL pattern;
A member route will require an ID, because it acts on a member.
photos/1/preview is an example of a member route, because it acts on (and displays) a single object.
Migrates database to a specified version. Whilst you can use this in your application, the recommended usage is via either the CLI or the provided GUI interface
Calculates the minimum value for a given property.
Uses the SQL function MIN.
If no records can be found to perform the calculation on you can use the ifNull argument to decide what should be returned.
Name
Type
Required
Default
Description
property
string
Yes
Name of the property to get the lowest value for (must be a property of a numeric data type).
where
string
No
Maps to the WHERE clause of the query (or HAVING when necessary). The following operators are supported: =, !=, <>, <, <=, >, >=, LIKE, NOT LIKE, IN, NOT IN, IS NULL, IS NOT NULL, AND, and OR (note that the key words need to be written in upper case). You can also use parentheses to group statements. Nested queries not allowed. You do not need to specify the table name(s); Wheels will do that for you.
include
string
No
Associations that should be included in the query using INNER or LEFT OUTER joins (which join type that is used depends on how the association has been set up in your model). If all included associations are set on the current model, you can specify them in a list (e.g. department,addresses,emails). You can build more complex include strings by using parentheses when the association is set on an included model, like album(artist(genre)), for example. These complex include strings only work when returnAs is set to query though.
parameterize
any
No
true
Set to true to use cfqueryparam on all columns, or pass in a list of property names to use cfqueryparam on those only.
ifNull
any
No
The value returned if no records are found. Common usage is to set this to 0 to make sure a numeric value is always returned instead of a blank string.
includeSoftDeletes
boolean
No
false
Set to true to include soft-deleted records in the queries that this method runs.
group
string
No
Maps to the GROUP BY clause of the query. You do not need to specify the table name(s); Wheels will do that for you.
Builds and returns a string containing one select form control for the minutes of an hour based on the supplied name.
Name
Type
Required
Default
Description
name
string
Yes
Name to populate in tag's name attribute.
selected
string
No
The day that should be selected initially.
minuteStep
numeric
No
1
Pass in 10 to only show minute 10, 20, 30, etc.
includeBlank
any
No
false
Whether to include a blank option in the select form control. Pass true to include a blank line or a string that should represent what display text should appear for the empty value (for example, "- Select One -").
label
string
No
The label text to use in the form control.
labelPlacement
string
No
around
Whether to place the label before, after, or wrapped around the form control. Label text placement can be controlled using aroundLeft or aroundRight.
prepend
string
No
String to prepend to the form control. Useful to wrap the form control with HTML tags.
append
string
No
String to append to the form control. Useful to wrap the form control with HTML tags.
prependToLabel
string
No
String to prepend to the form control's label. Useful to wrap the form control with HTML tags.
appendToLabel
string
No
String to append to the form control's label. Useful to wrap the form control with HTML tags.
encode
any
No
true
Use this argument to decide whether the output of the function should be encoded in order to prevent Cross Site Scripting (XSS) attacks. Set it to true to encode all relevant output for the specific HTML element in question (e.g. tag content, attribute values, and URLs). For HTML elements that have both tag content and attribute values you can set this argument to attributes to only encode attribute values and not tag content.
Whether to include a blank option in the select form control. Pass true to include a blank line or a string that should represent what display text should appear for the empty value (for example, "- Select One -").
label
string
No
The label text to use in the form control.
labelPlacement
string
No
around
Whether to place the label before, after, or wrapped around the form control. Label text placement can be controlled using aroundLeft or aroundRight.
prepend
string
No
String to prepend to the form control. Useful to wrap the form control with HTML tags.
append
string
No
String to append to the form control. Useful to wrap the form control with HTML tags.
prependToLabel
string
No
String to prepend to the form control's label. Useful to wrap the form control with HTML tags.
appendToLabel
string
No
String to append to the form control's label. Useful to wrap the form control with HTML tags.
encode
any
No
true
Use this argument to decide whether the output of the function should be encoded in order to prevent Cross Site Scripting (XSS) attacks. Set it to true to encode all relevant output for the specific HTML element in question (e.g. tag content, attribute values, and URLs). For HTML elements that have both tag content and attribute values you can set this argument to attributes to only encode attribute values and not tag content.
Allows for nested objects, structs, and arrays to be set from params and other generated data.
Name
Type
Required
Default
Description
association
string
No
The association (or list of associations) you want to allow to be set through the params. This argument is also aliased as associations.
autoSave
boolean
No
true
Whether to save the association(s) when the parent object is saved.
allowDelete
boolean
No
false
Set this to true to tell Wheels to look for the property _delete in your model. If present and set to a value that evaluates to true, the model will be deleted when saving the parent.
sortProperty
string
No
Set this to a property on the object that you would like to sort by. The property should be numeric, should start with 1, and should be consecutive. Only valid with hasMany associations.
rejectIfBlank
string
No
A list of properties that should not be blank. If any of the properties are blank, any CRUD operations will be rejected.
Creates a new object based on supplied properties and returns it.
The object is not saved to the database, it only exists in memory.
Property names and values can be passed in either using named arguments or as a struct to the properties argument.
Name
Type
Required
Default
Description
properties
struct
No
[runtime expression]
The properties you want to set on the object (can also be passed in as named arguments).
callbacks
boolean
No
true
Set to false to disable callbacks for this method.
allowExplicitTimestamps
boolean
No
false
Set this to true to allow explicit assignment of createdAt or updatedAt properties
Use this in an individual controller action to define which formats the action will respond with.
This can be used to define provides behavior in individual actions or to override a global setting set with provides in the controller's config().
Name
Type
Required
Default
Description
formats
string
No
Formats to instruct the controller to provide. Valid values are html (the default), xml, json, csv, pdf, and xls.
Returns a struct with information about the specified paginated query.
The keys that will be included in the struct are currentPage, totalPages and totalRecords.
Name
Type
Required
Default
Description
handle
string
No
query
The handle given to the query to return pagination information for.
Builds and returns a string containing links to pages based on a paginated query.
Uses linkTo() internally to build the link, so you need to pass in a route name or a controller/action/key combination.
All other linkTo() arguments can be supplied as well, in which case they are passed through directly to linkTo().
If you have paginated more than one query in the controller, you can use the handle argument to reference them. (Don't forget to pass in a handle to the findAll() function in your controller first.)
Name
Type
Required
Default
Description
windowSize
numeric
No
2
The number of page links to show around the current page.
alwaysShowAnchors
boolean
No
true
Whether or not links to the first and last page should always be displayed.
anchorDivider
string
No
...
String to place next to the anchors on either side of the list.
linkToCurrentPage
boolean
No
false
Whether or not the current page should be linked to.
prepend
string
No
String or HTML to be prepended before result.
append
string
No
String or HTML to be appended after result.
prependToPage
string
No
String or HTML to be prepended before each page number.
addActiveClassToPrependedParent
boolean
No
false
prependOnFirst
boolean
No
true
Whether or not to prepend the prependToPage string on the first page in the list.
prependOnAnchor
boolean
No
true
Whether or not to prepend the prependToPage string on the anchors.
appendToPage
string
No
String or HTML to be appended after each page number.
appendOnLast
boolean
No
true
Whether or not to append the appendToPage string on the last page in the list.
appendOnAnchor
boolean
No
true
Whether or not to append the appendToPage string on the anchors.
classForCurrent
string
No
Class name for the current page number (if linkToCurrentPage is true, the class name will go on the a element. If not, a span element will be used).
handle
string
No
query
The handle given to the query that the pagination links should be displayed for.
name
string
No
page
The name of the param that holds the current page number.
showSinglePage
boolean
No
false
Will show a single page when set to true. (The default behavior is to return an empty string when there is only one page in the pagination).
pageNumberAsParam
boolean
No
true
Decides whether to link the page number as a param or as part of a route. (The default behavior is true).
encode
any
No
true
Use this argument to decide whether the output of the function should be encoded in order to prevent Cross Site Scripting (XSS) attacks. Set it to true to encode all relevant output for the specific HTML element in question (e.g. tag content, attribute values, and URLs). For HTML elements that have both tag content and attribute values you can set this argument to attributes to only encode attribute values and not tag content.
Builds and returns a string containing a password field form control based on the supplied objectName and property.
Note: Pass any additional arguments like class, rel, and id, and the generated tag will also include those values as HTML attributes.
Name
Type
Required
Default
Description
objectName
any
Yes
The variable name of the object to build the form control for.
property
string
Yes
The name of the property to use in the form control.
association
string
No
The name of the association that the property is located on. Used for building nested forms that work with nested properties. If you are building a form with deep nesting, simply pass in a list to the nested object, and Wheels will figure it out.
position
string
No
The position used when referencing a hasMany relationship in the association argument. Used for building nested forms that work with nested properties. If you are building a form with deep nestings, simply pass in a list of positions, and Wheels will figure it out.
label
string
No
useDefaultLabel
The label text to use in the form control.
labelPlacement
string
No
around
Whether to place the label before, after, or wrapped around the form control. Label text placement can be controlled using aroundLeft or aroundRight.
prepend
string
No
String to prepend to the form control. Useful to wrap the form control with HTML tags.
append
string
No
String to append to the form control. Useful to wrap the form control with HTML tags.
prependToLabel
string
No
String to prepend to the form control's label. Useful to wrap the form control with HTML tags.
appendToLabel
string
No
String to append to the form control's label. Useful to wrap the form control with HTML tags.
errorElement
string
No
span
HTML tag to wrap the form control with when the object contains errors.
errorClass
string
No
field-with-errors
The class name of the HTML tag that wraps the form control when there are errors.
encode
any
No
true
Use this argument to decide whether the output of the function should be encoded in order to prevent Cross Site Scripting (XSS) attacks. Set it to true to encode all relevant output for the specific HTML element in question (e.g. tag content, attribute values, and URLs). For HTML elements that have both tag content and attribute values you can set this argument to attributes to only encode attribute values and not tag content.
Builds and returns a string containing a password field form control based on the supplied name.
Note: Pass any additional arguments like class, rel, and id, and the generated tag will also include those values as HTML attributes.
Name
Type
Required
Default
Description
name
string
Yes
Name to populate in tag's name attribute.
value
string
No
Value to populate in tag's value attribute.
label
string
No
The label text to use in the form control.
labelPlacement
string
No
around
Whether to place the label before, after, or wrapped around the form control. Label text placement can be controlled using aroundLeft or aroundRight.
prepend
string
No
String to prepend to the form control. Useful to wrap the form control with HTML tags.
append
string
No
String to append to the form control. Useful to wrap the form control with HTML tags.
prependToLabel
string
No
String to prepend to the form control's label. Useful to wrap the form control with HTML tags.
appendToLabel
string
No
String to append to the form control's label. Useful to wrap the form control with HTML tags.
encode
any
No
true
Use this argument to decide whether the output of the function should be encoded in order to prevent Cross Site Scripting (XSS) attacks. Set it to true to encode all relevant output for the specific HTML element in question (e.g. tag content, attribute values, and URLs). For HTML elements that have both tag content and attribute values you can set this argument to attributes to only encode attribute values and not tag content.
Create a route that matches a URL requiring an HTTP PATCH method. We recommend using this matcher to expose actions that update database records.
Name
Type
Required
Default
Description
name
string
No
Camel-case name of route to reference when build links and form actions (e.g., blogPost).
pattern
string
No
Overrides the URL pattern that will match the route. The default value is a dasherized version of name (e.g., a name of blogPost generates a pattern of blog-post).
to
string
No
Set controller##action combination to map the route to. You may use either this argument or a combination of controller and action.
controller
string
No
Map the route to a given controller. This must be passed along with the action argument.
action
string
No
Map the route to a given action within the controller. This must be passed along with the controller argument.
package
string
No
Indicates a subfolder that the controller will be referenced from (but not added to the URL pattern). For example, if you set this to admin, the controller will be located at admin/YourController.cfc, but the URL path will not contain admin/.
on
string
No
If this route is within a nested resource, you can set this argument to member or collection. A member route contains a reference to the resource's key, while a collection route does not.
redirect
string
No
Redirect via 302 to this URL when this route is matched. Has precedence over controller/action. Use either an absolute link like /about/, or a full canonical link.
Returns the plural form of the passed in word. Can also pluralize a word based on a value passed to the count argument. Wheels stores a list of words that are the same in both singular and plural form (e.g. "equipment", "information") and words that don't follow the regular pluralization rules (e.g. "child" / "children", "foot" / "feet"). Use get("uncountables") / set("uncountables", newList) and get("irregulars") / set("irregulars", newList) to modify them to suit your needs.
Name
Type
Required
Default
Description
word
string
Yes
The word to pluralize.
count
numeric
No
-1
Pluralization will occur when this value is not 1.
returnCount
boolean
No
true
Will return count prepended to the pluralization when true and count is not -1.
Create a route that matches a URL requiring an HTTP POST method. We recommend using this matcher to expose actions that create database records.
Name
Type
Required
Default
Description
name
string
No
Camel-case name of route to reference when build links and form actions (e.g., blogPosts).
pattern
string
No
Overrides the URL pattern that will match the route. The default value is a dasherized version of name (e.g., a name of blogPosts generates a pattern of blog-posts).
to
string
No
Set controller##action combination to map the route to. You may use either this argument or a combination of controller and action.
controller
string
No
Map the route to a given controller. This must be passed along with the action argument.
action
string
No
Map the route to a given action within the controller. This must be passed along with the controller argument.
package
string
No
Indicates a subfolder that the controller will be referenced from (but not added to the URL pattern). For example, if you set this to admin, the controller will be located at admin/YourController.cfc, but the URL path will not contain admin/.
on
string
No
If this route is within a nested resource, you can set this argument to member or collection. A member route contains a reference to the resource's key, while a collection route does not.
redirect
string
No
Redirect via 302 to this URL when this route is matched. Has precedence over controller/action. Use either an absolute link like /about/, or a full canonical link.
Returns the name of the primary key for this model's table.
This is determined through database introspection.
If composite primary keys have been used, they will both be returned in a list.
This function is also aliased as primaryKeys().
Name
Type
Required
Default
Description
position
numeric
No
0
If you are accessing a composite primary key, pass the position of a single key to fetch.
Process the specified action of the controller.
This is exposed in the API primarily for testing purposes; you would not usually call it directly unless in the test suite.
Name
Type
Required
Default
Description
includeFilters
string
No
true
Set to before to only execute "before" filters, after to only execute "after" filters or false to skip all filters. This argument is generally inherited from the processRequest function during unit test execution.
Creates a controller and calls an action on it.
Which controller and action that's called is determined by the params passed in.
Returns the result of the request either as a string or in a struct with body, emails, files, flash, redirect, status, and type.
Primarily used for testing purposes.
Name
Type
Required
Default
Description
params
struct
Yes
The params struct to use in the request (make sure that at least controller and action are set).
method
string
No
get
The HTTP method to use in the request (get, post etc).
returnAs
string
No
Pass in struct to return all information about the request instead of just the final output (body).
rollback
string
No
false
Pass in true to roll back all database transactions made during the request.
includeFilters
string
No
true
Set to before to only execute "before" filters, after to only execute "after" filters or false to skip all filters.
Use this method to map an object property to either a table column with a different name than the property or to a SQL expression.
You only need to use this method when you want to override the default object relational mapping that Wheels performs.
Name
Type
Required
Default
Description
name
string
Yes
The name that you want to use for the column or SQL function result in the CFML code.
column
string
No
The name of the column in the database table to map the property to.
sql
string
No
An SQL expression to use to calculate the property value.
label
string
No
A custom label for this property to be referenced in the interface and error messages.
defaultValue
string
No
A default value for this property.
select
boolean
No
true
Whether to include this property by default in SELECT statements
dataType
string
No
char
Specify the column dataType for this property
automaticValidations
boolean
No
Enable / disable automatic validations for this property.
Returns a list of property names ordered by their respective column's ordinal position in the database table.
Also includes calculated property names that will be generated by the Wheels ORM.
Tells Wheels to protect POSTed requests from CSRF vulnerabilities.
Instructs the controller to verify that params.authenticityToken or X-CSRF-Token HTTP header is provided along with the request containing a valid authenticity token.
Call this method within a controller's config method, preferably the base Controller.cfc file, to protect the entire application.
Name
Type
Required
Default
Description
with
string
No
exception
How to handle invalid authenticity token checks. Valid values are error (throws a Wheels.InvalidAuthenticityToken error), abort (aborts the request silently and sends a blank response to the client), and ignore (ignores the check and lets the request proceed).
only
string
No
List of actions that this check should only run on. Leave blank for all.
except
string
No
List of actions that this check should be omitted from running on. Leave blank for no exceptions.
Defines formats that the controller will respond with upon request.
The format can be requested through a URL variable called format, by appending the format name to the end of a URL as an extension (when URL rewriting is enabled), or in the request header.
Name
Type
Required
Default
Description
formats
string
No
Formats to instruct the controller to provide. Valid values are html (the default), xml, json, csv, pdf, and xls.
Create a route that matches a URL requiring an HTTP PUT method. We recommend using this matcher to expose actions that update database records. This method is provided as a convenience for when you really need to support the PUT verb; consider using the patch matcher instead of this one.
Name
Type
Required
Default
Description
name
string
No
Camel-case name of route to reference when build links and form actions (e.g., blogPost).
pattern
string
No
Overrides the URL pattern that will match the route. The default value is a dasherized version of name (e.g., a name of blogPost generates a pattern of blog-post).
to
string
No
Set controller##action combination to map the route to. You may use either this argument or a combination of controller and action.
controller
string
No
Map the route to a given controller. This must be passed along with the action argument.
action
string
No
Map the route to a given action within the controller. This must be passed along with the controller argument.
package
string
No
Indicates a subfolder that the controller will be referenced from (but not added to the URL pattern). For example, if you set this to admin, the controller will be located at admin/YourController.cfc, but the URL path will not contain admin/.
on
string
No
If this route is within a nested resource, you can set this argument to member or collection. A member route contains a reference to the resource's key, while a collection route does not.
redirect
string
No
Redirect via 302 to this URL when this route is matched. Has precedence over controller/action. Use either an absolute link like /about/, or a full canonical link.
Builds and returns a string containing a radio button form control based on the supplied objectName and property.
Note: Pass any additional arguments like class, rel, and id, and the generated tag will also include those values as HTML attributes.
Name
Type
Required
Default
Description
objectName
any
Yes
The variable name of the object to build the form control for.
property
string
Yes
The name of the property to use in the form control.
association
string
No
The name of the association that the property is located on. Used for building nested forms that work with nested properties. If you are building a form with deep nesting, simply pass in a list to the nested object, and Wheels will figure it out.
position
string
No
The position used when referencing a hasMany relationship in the association argument. Used for building nested forms that work with nested properties. If you are building a form with deep nestings, simply pass in a list of positions, and Wheels will figure it out.
tagValue
string
No
The value of the radio button when selected.
label
string
No
useDefaultLabel
The label text to use in the form control.
labelPlacement
string
No
around
Whether to place the label before, after, or wrapped around the form control. Label text placement can be controlled using aroundLeft or aroundRight.
prepend
string
No
String to prepend to the form control. Useful to wrap the form control with HTML tags.
append
string
No
String to append to the form control. Useful to wrap the form control with HTML tags.
prependToLabel
string
No
String to prepend to the form control's label. Useful to wrap the form control with HTML tags.
appendToLabel
string
No
String to append to the form control's label. Useful to wrap the form control with HTML tags.
errorElement
string
No
span
HTML tag to wrap the form control with when the object contains errors.
errorClass
string
No
field-with-errors
The class name of the HTML tag that wraps the form control when there are errors.
encode
any
No
true
Use this argument to decide whether the output of the function should be encoded in order to prevent Cross Site Scripting (XSS) attacks. Set it to true to encode all relevant output for the specific HTML element in question (e.g. tag content, attribute values, and URLs). For HTML elements that have both tag content and attribute values you can set this argument to attributes to only encode attribute values and not tag content.
Builds and returns a string containing a radio button form control based on the supplied name.
Note: Pass any additional arguments like class, rel, and id, and the generated tag will also include those values as HTML attributes.
Name
Type
Required
Default
Description
name
string
Yes
Name to populate in tag's name attribute.
value
string
Yes
Value to populate in tag's value attribute.
checked
boolean
No
false
Whether or not to check the radio button by default.
label
string
No
The label text to use in the form control.
labelPlacement
string
No
around
Whether to place the label before, after, or wrapped around the form control. Label text placement can be controlled using aroundLeft or aroundRight.
prepend
string
No
String to prepend to the form control. Useful to wrap the form control with HTML tags.
append
string
No
String to append to the form control. Useful to wrap the form control with HTML tags.
prependToLabel
string
No
String to prepend to the form control's label. Useful to wrap the form control with HTML tags.
appendToLabel
string
No
String to append to the form control's label. Useful to wrap the form control with HTML tags.
encode
any
No
true
Use this argument to decide whether the output of the function should be encoded in order to prevent Cross Site Scripting (XSS) attacks. Set it to true to encode all relevant output for the specific HTML element in question (e.g. tag content, attribute values, and URLs). For HTML elements that have both tag content and attribute values you can set this argument to attributes to only encode attribute values and not tag content.
Redirects the browser to the supplied controller/action/key, route or back to the referring page.
Internally, this function uses the URLFor function to build the link and the cflocation tag to perform the redirect.
Name
Type
Required
Default
Description
back
boolean
No
false
Set to true to redirect back to the referring page.
addToken
boolean
No
false
See documentation for your CFML engine's implementation of cflocation.
statusCode
numeric
No
302
See documentation for your CFML engine's implementation of cflocation.
route
string
No
Name of a route that you have configured in config/routes.cfm.
method
string
No
controller
string
No
Name of the controller to include in the URL.
action
string
No
Name of the action to include in the URL.
key
any
No
Key(s) to include in the URL.
params
string
No
Any additional parameters to be set in the query string (example: wheels=cool&x=y). Please note that Wheels uses the & and = characters to split the parameters and encode them properly for you. However, if you need to pass in & or = as part of the value, then you need to encode them (and only them), example: a=cats%26dogs%3Dtrouble!&b=1.
anchor
string
No
Sets an anchor name to be appended to the path.
onlyPath
boolean
No
true
If true, returns only the relative URL (no protocol, host name or port).
host
string
No
Set this to override the current host.
protocol
string
No
Set this to override the current protocol.
port
numeric
No
0
Set this to override the current port number.
url
string
No
Redirect to an external URL.
delay
boolean
No
false
Set to true to delay the redirection until after the rest of your action code has executed.
encode
boolean
No
true
Encode URL parameters using EncodeForURL(). Please note that this does not make the string safe for placement in HTML attributes, for that you need to wrap the result in EncodeForHtmlAttribute() or use linkTo(), startFormTag() etc instead.
Reruns the specified migration version. Whilst you can use this in your application, the recommended usage is via either the CLI or the provided GUI interface
Instructs the controller to render an empty string when it's finished processing the action.
This is very similar to calling cfabort with the advantage that any after filters you have set on the action will still be run.
Name
Type
Required
Default
Description
status
string
No
[runtime expression]
Force request to return with specific HTTP status code.
Instructs the controller to render a partial when it's finished processing the action.
Name
Type
Required
Default
Description
partial
string
Yes
The name of the partial file to be used. Prefix with a leading slash (/) if you need to build a path from the root views folder. Do not include the partial filename's underscore and file extension.
cache
any
No
Number of minutes to cache the content for.
layout
string
No
The layout to wrap the content in. Prefix with a leading slash (/) if you need to build a path from the root views folder. Pass false to not load a layout at all.
returnAs
string
No
Set to string to return the result instead of automatically sending it to the client.
dataFunction
any
No
true
Name of a controller function to load data from.
status
string
No
[runtime expression]
Force request to return with specific HTTP status code.
Instructs the controller which view template and layout to render when it's finished processing the action.
Note that when passing values for controller and / or action, this function does not execute the actual action but rather just loads the corresponding view template.
Name
Type
Required
Default
Description
controller
string
No
[runtime expression]
Controller to include the view page for.
action
string
No
[runtime expression]
Action to include the view page for.
template
string
No
A specific template to render. Prefix with a leading slash (/) if you need to build a path from the root views folder.
layout
any
No
The layout to wrap the content in. Prefix with a leading slash (/) if you need to build a path from the root views folder. Pass false to not load a layout at all.
cache
any
No
Number of minutes to cache the content for.
returnAs
string
No
Set to string to return the result instead of automatically sending it to the client.
hideDebugInformation
boolean
No
false
Set to true to hide the debug information at the end of the output. This is useful, for example, when you're testing XML output in an environment where the global setting for showDebugInformation is true.
status
string
No
[runtime expression]
Force request to return with specific HTTP status code.
Instructs the controller to render the data passed in to the format that is requested.
If the format requested is json or xml, Wheels will transform the data into that format automatically.
For other formats (or to override the automatic formatting), you can also create a view template in this format: nameofaction.xml.cfm, nameofaction.json.cfm, nameofaction.pdf.cfm, etc.
Name
Type
Required
Default
Description
data
any
Yes
Data to format and render.
controller
string
No
[runtime expression]
Controller to include the view page for.
action
string
No
[runtime expression]
Action to include the view page for.
template
string
No
A specific template to render. Prefix with a leading slash (/) if you need to build a path from the root views folder.
layout
any
No
The layout to wrap the content in. Prefix with a leading slash (/) if you need to build a path from the root views folder. Pass false to not load a layout at all.
cache
any
No
Number of minutes to cache the content for.
returnAs
string
No
Set to string to return the result instead of automatically sending it to the client.
hideDebugInformation
boolean
No
false
Set to true to hide the debug information at the end of the output. This is useful, for example, when you're testing XML output in an environment where the global setting for showDebugInformation is true.
status
string
No
[runtime expression]
Force request to return with specific HTTP status code.
Create a group of routes that exposes actions for manipulating a singular resource. A singular resource exposes URL patterns for the entire CRUD lifecycle of a single entity (show, new, create, edit, update, and delete) without exposing a primary key in the URL. Usually this type of resource represents a singleton entity tied to the session, application, or another resource (perhaps nested within another resource). If you need to generate routes for manipulating a collection of resources with a primary key in the URL, see the resources mapper method.
Name
Type
Required
Default
Description
name
string
Yes
Camel-case name of resource to reference when build links and form actions. This is typically a singular word (e.g., profile).
nested
boolean
No
false
Whether or not additional calls will be nested within this resource.
path
string
No
[runtime expression]
Override URL path representing this resource. Default is a dasherized version of name (e.g., blogPost generates a path of blog-post).
controller
string
No
Override name of the controller used by resource. This defaults to a pluralized version of name.
singular
string
No
Override singularize() result in plural resources.
plural
string
No
Override pluralize() result in singular resource.
only
string
No
Limits the list of RESTful routes to generate. Can include show, new, create, edit, update, and delete.
except
string
No
Excludes RESTful routes to generate, taking priority over the only argument. Can include show, new, create, edit,update, and delete.
shallow
boolean
No
Turn on shallow resources.
shallowPath
string
No
Shallow path prefix.
shallowName
string
No
Shallow name prefix.
constraints
struct
No
Variable patterns to use for matching.
mapFormat
boolean
No
[runtime expression]
Whether or not to add an optional .[format] pattern to the end of the generated routes. This is useful for providing formats via URL like json, xml, pdf, etc.
Create a group of routes that exposes actions for manipulating a collection of resources. A plural resource exposes URL patterns for the entire CRUD lifecycle (index, show, new, create, edit, update, delete), exposing a primary key in the URL for showing, editing, updating, and deleting records. If you need to generate routes for manipulating a singular resource without a primary key, see the resource mapper method.
Name
Type
Required
Default
Description
name
string
Yes
Camel-case name of resource to reference when build links and form actions. This is typically a plural word (e.g., posts).
nested
boolean
No
false
Whether or not additional calls will be nested within this resource.
path
string
No
[runtime expression]
Override URL path representing this resource. Default is a dasherized version of name (e.g., blogPosts generates a path of blog-posts).
controller
string
No
Override name of the controller used by resource. This defaults to the value provided for name.
singular
string
No
Override singularize() result in plural resources.
plural
string
No
Override pluralize() result in singular resource.
only
string
No
Limits the list of RESTful routes to generate. Can include index, show, new, create, edit, update, and delete.
except
string
No
Excludes RESTful routes to generate, taking priority over the only argument. Can include index, show, new, create, edit, update, and delete.
shallow
boolean
No
Turn on shallow resources.
shallowPath
string
No
Shallow path prefix.
shallowName
string
No
Shallow name prefix.
constraints
struct
No
Variable patterns to use for matching.
mapFormat
boolean
No
[runtime expression]
Whether or not to add an optional .[format] pattern to the end of the generated routes. This is useful for providing formats via URL like json, xml, pdf, etc.
Create a route that matches the root of its current context. This mapper can be used for the application's web root (or home page), or it can generate a route for the root of a namespace or other path scoping mapper.
Name
Type
Required
Default
Description
to
string
No
Set controller##action combination to map the route to. You may use either this argument or a combination of controller and action.
mapFormat
boolean
No
Set to true to include the format (e.g. .json) in the route.
Saves the object if it passes validation and callbacks.
Returns true if the object was saved successfully to the database, false if not.
Name
Type
Required
Default
Description
parameterize
any
No
true
Set to true to use cfqueryparam on all columns, or pass in a list of property names to use cfqueryparam on those only.
reload
boolean
No
false
Set to true to force Wheels to query the database even though an identical query for this model may have been run in the same request. (The default in Wheels is to get the second query from the model's request-level cache.)
validate
boolean
No
true
Set to false to skip validations for this operation.
transaction
string
No
[runtime expression]
Set this to commit to update the database, rollback to run all the database queries but not commit them, or none to skip transaction handling altogether.
callbacks
boolean
No
true
Set to false to disable callbacks for this method.
Set any number of parameters to be inherited by mappers called within this matcher's block. For example, set a package or URL path to be used by all child routes.
Name
Type
Required
Default
Description
name
string
No
Name to prepend to child route names for use when building links, forms, and other URLs.
path
string
No
Path to prefix to all child routes.
package
string
No
Package namespace to append to controllers.
controller
string
No
Controller to use for routes.
shallow
boolean
No
Turn on shallow resources to eliminate routing added before this one.
Builds and returns a string containing one select form control for the seconds of a minute based on the supplied name.
Name
Type
Required
Default
Description
name
string
Yes
Name to populate in tag's name attribute.
selected
string
No
The day that should be selected initially.
secondStep
numeric
No
1
Pass in 10 to only show seconds 10, 20, 30, etc.
includeBlank
any
No
false
Whether to include a blank option in the select form control. Pass true to include a blank line or a string that should represent what display text should appear for the empty value (for example, "- Select One -").
label
string
No
The label text to use in the form control.
labelPlacement
string
No
around
Whether to place the label before, after, or wrapped around the form control. Label text placement can be controlled using aroundLeft or aroundRight.
prepend
string
No
String to prepend to the form control. Useful to wrap the form control with HTML tags.
append
string
No
String to append to the form control. Useful to wrap the form control with HTML tags.
prependToLabel
string
No
String to prepend to the form control's label. Useful to wrap the form control with HTML tags.
appendToLabel
string
No
String to append to the form control's label. Useful to wrap the form control with HTML tags.
encode
any
No
true
Use this argument to decide whether the output of the function should be encoded in order to prevent Cross Site Scripting (XSS) attacks. Set it to true to encode all relevant output for the specific HTML element in question (e.g. tag content, attribute values, and URLs). For HTML elements that have both tag content and attribute values you can set this argument to attributes to only encode attribute values and not tag content.
Builds and returns a string containing a select form control based on the supplied objectName and property.
Note: Pass any additional arguments like class, rel, and id, and the generated tag will also include those values as HTML attributes.
Name
Type
Required
Default
Description
objectName
any
Yes
The variable name of the object to build the form control for.
property
string
Yes
The name of the property to use in the form control.
association
string
No
The name of the association that the property is located on. Used for building nested forms that work with nested properties. If you are building a form with deep nesting, simply pass in a list to the nested object, and Wheels will figure it out.
position
string
No
The position used when referencing a hasMany relationship in the association argument. Used for building nested forms that work with nested properties. If you are building a form with deep nestings, simply pass in a list of positions, and Wheels will figure it out.
options
any
No
A collection to populate the select form control with. Can be a query recordSet or an array of objects.
includeBlank
any
No
false
Whether to include a blank option in the select form control. Pass true to include a blank line or a string that should represent what display text should appear for the empty value (for example, "- Select One -").
valueField
string
No
The column or property to use for the value of each list element. Used only when a query or array of objects has been supplied in the options argument. Required when specifying textField
textField
string
No
The column or property to use for the value of each list element that the end user will see. Used only when a query or array of objects has been supplied in the options argument. Required when specifying valueField
label
string
No
useDefaultLabel
The label text to use in the form control.
labelPlacement
string
No
around
Whether to place the label before, after, or wrapped around the form control. Label text placement can be controlled using aroundLeft or aroundRight.
prepend
string
No
String to prepend to the form control. Useful to wrap the form control with HTML tags.
append
string
No
String to append to the form control. Useful to wrap the form control with HTML tags.
prependToLabel
string
No
String to prepend to the form control's label. Useful to wrap the form control with HTML tags.
appendToLabel
string
No
String to append to the form control's label. Useful to wrap the form control with HTML tags.
errorElement
string
No
span
HTML tag to wrap the form control with when the object contains errors.
errorClass
string
No
field-with-errors
The class name of the HTML tag that wraps the form control when there are errors.
encode
any
No
true
Use this argument to decide whether the output of the function should be encoded in order to prevent Cross Site Scripting (XSS) attacks. Set it to true to encode all relevant output for the specific HTML element in question (e.g. tag content, attribute values, and URLs). For HTML elements that have both tag content and attribute values you can set this argument to attributes to only encode attribute values and not tag content.
Builds and returns a string containing a select form control based on the supplied name and options.
Note: Pass any additional arguments like class, rel, and id, and the generated tag will also include those values as HTML attributes.
Name
Type
Required
Default
Description
name
string
Yes
Name to populate in tag's name attribute.
options
any
Yes
A collection to populate the select form control with. Can be a query recordSet or an array of objects.
selected
string
No
Value of option that should be selected by default.
includeBlank
any
No
false
Whether to include a blank option in the select form control. Pass true to include a blank line or a string that should represent what display text should appear for the empty value (for example, "- Select One -").
multiple
boolean
No
false
Whether to allow multiple selection of options in the select form control.
valueField
string
No
The column or property to use for the value of each list element. Used only when a query or array of objects has been supplied in the options argument. Required when specifying textField
textField
string
No
The column or property to use for the value of each list element that the end user will see. Used only when a query or array of objects has been supplied in the options argument. Required when specifying valueField
label
string
No
The label text to use in the form control.
labelPlacement
string
No
around
Whether to place the label before, after, or wrapped around the form control. Label text placement can be controlled using aroundLeft or aroundRight.
prepend
string
No
String to prepend to the form control. Useful to wrap the form control with HTML tags.
append
string
No
String to append to the form control. Useful to wrap the form control with HTML tags.
prependToLabel
string
No
String to prepend to the form control's label. Useful to wrap the form control with HTML tags.
appendToLabel
string
No
String to append to the form control's label. Useful to wrap the form control with HTML tags.
encode
any
No
true
Use this argument to decide whether the output of the function should be encoded in order to prevent Cross Site Scripting (XSS) attacks. Set it to true to encode all relevant output for the specific HTML element in question (e.g. tag content, attribute values, and URLs). For HTML elements that have both tag content and attribute values you can set this argument to attributes to only encode attribute values and not tag content.
Sends an email using a template and an optional layout to wrap it in.
Besides the Wheels-specific arguments documented here, you can also pass in any argument that is accepted by the cfmail tag as well as your own arguments to be used by the view.
Name
Type
Required
Default
Description
template
string
No
The path to the email template or two paths if you want to send a multipart email. if the detectMultipart argument is false, the template for the text version should be the first one in the list. This argument is also aliased as templates.
from
string
Yes
Email address to send from.
to
string
Yes
List of email addresses to send the email to.
subject
string
Yes
The subject line of the email.
layout
any
No
false
Layout(s) to wrap the email template in. This argument is also aliased as layouts.
file
string
No
A list of the names of the files to attach to the email. This will reference files stored in the files folder (or a path relative to it). This argument is also aliased as files.
detectMultipart
boolean
No
true
When set to true and multiple values are provided for the template argument, Wheels will detect which of the templates is text and which one is HTML (by counting the < characters).
deliver
boolean
No
true
When set to false, the email will not be sent.
writeToFile
string
No
The file to which the email contents will be written
Use this function if you need a more low level way of setting the entire filter chain for a controller.
Name
Type
Required
Default
Description
chain
array
Yes
An array of structs, each of which represent an argumentCollection that get passed to the filters function. This should represent the entire filter chain that you want to use for this controller.
Allows you to pass in the name(s) of the property(s) that should be used as the primary key(s).
Pass as a list if defining a composite primary key.
This function is also aliased as setPrimaryKeys().
Name
Type
Required
Default
Description
property
string
Yes
Property (or list of properties) to set as the primary key.
Use this function if you need a more low level way of setting the entire verification chain for a controller.
Name
Type
Required
Default
Description
chain
array
Yes
An array of structs, each of which represent an argumentCollection that get passed to the verifies function. This should represent the entire verification chain that you want to use for this controller.
Returns formatted text using HTML break tags ( ) and HTML paragraph elements () based on the newline characters and carriage returns in the text that is passed in.
Name
Type
Required
Default
Description
text
string
Yes
The text to format.
wrap
boolean
No
true
Set to true to wrap the result in a paragraph HTML element.
encode
boolean
No
true
Use this argument to decide whether the output of the function should be encoded in order to prevent Cross Site Scripting (XSS) attacks. Set it to true to encode all relevant output for the specific HTML element in question (e.g. tag content, attribute values, and URLs). For HTML elements that have both tag content and attribute values you can set this argument to attributes to only encode attribute values and not tag content.
Builds and returns a string containing the opening form tag.
The form's action will be built according to the same rules as URLFor.
Note: Pass any additional arguments like class, rel, and id, and the generated tag will also include those values as HTML attributes.
Name
Type
Required
Default
Description
method
string
No
post
The type of method to use in the form tag (delete, get, patch, post, and put are the options).
multipart
boolean
No
false
Set to true if the form should be able to upload files.
route
string
No
Name of a route that you have configured in config/routes.cfm.
controller
string
No
Name of the controller to include in the URL.
action
string
No
Name of the action to include in the URL.
key
any
No
Key(s) to include in the URL.
params
string
No
Any additional parameters to be set in the query string (example: wheels=cool&x=y). Please note that Wheels uses the & and = characters to split the parameters and encode them properly for you. However, if you need to pass in & or = as part of the value, then you need to encode them (and only them), example: a=cats%26dogs%3Dtrouble!&b=1.
anchor
string
No
Sets an anchor name to be appended to the path.
onlyPath
boolean
No
true
If true, returns only the relative URL (no protocol, host name or port).
host
string
No
Set this to override the current host.
protocol
string
No
Set this to override the current protocol.
port
numeric
No
0
Set this to override the current port number.
prepend
string
No
String to prepend to the form control. Useful to wrap the form control with HTML tags.
append
string
No
String to append to the form control. Useful to wrap the form control with HTML tags.
encode
any
No
true
Use this argument to decide whether the output of the function should be encoded in order to prevent Cross Site Scripting (XSS) attacks. Set it to true to encode all relevant output for the specific HTML element in question (e.g. tag content, attribute values, and URLs). For HTML elements that have both tag content and attribute values you can set this argument to attributes to only encode attribute values and not tag content.
Removes all links from an HTML string, leaving just the link text.
Name
Type
Required
Default
Description
html
string
Yes
The HTML to remove links from.
encode
boolean
No
true
Use this argument to decide whether the output of the function should be encoded in order to prevent Cross Site Scripting (XSS) attacks. Set it to true to encode all relevant output for the specific HTML element in question (e.g. tag content, attribute values, and URLs). For HTML elements that have both tag content and attribute values you can set this argument to attributes to only encode attribute values and not tag content.
Use this argument to decide whether the output of the function should be encoded in order to prevent Cross Site Scripting (XSS) attacks. Set it to true to encode all relevant output for the specific HTML element in question (e.g. tag content, attribute values, and URLs). For HTML elements that have both tag content and attribute values you can set this argument to attributes to only encode attribute values and not tag content.
Returns a link tag for a stylesheet (or several) based on the supplied arguments.
Name
Type
Required
Default
Description
sources
string
No
The name of one or many CSS files in the stylesheets folder, minus the .css extension. Pass a full URL to generate a tag for an external style sheet. Can also be called with the source argument.
type
string
No
text/css
The type attribute for the link tag.
media
string
No
all
The media attribute for the link tag.
rel
string
No
The rel attribute for the relation between the tag and href.
head
boolean
No
false
Set to true to place the output in the head area of the HTML page instead of the default behavior (which is to place the output where the function is called from).
delim
string
No
,
The delimiter to use for the list of CSS files.
encode
boolean
No
true
Use this argument to decide whether the output of the function should be encoded in order to prevent Cross Site Scripting (XSS) attacks. Set it to true to encode all relevant output for the specific HTML element in question (e.g. tag content, attribute values, and URLs). For HTML elements that have both tag content and attribute values you can set this argument to attributes to only encode attribute values and not tag content.
Builds and returns a string containing a submit button form control.
Note: Pass any additional arguments like class, rel, and id, and the generated tag will also include those values as HTML attributes.
Name
Type
Required
Default
Description
value
string
No
Save changes
Message to display in the button form control.
image
string
No
File name of the image file to use in the button form control.
prepend
string
No
String to prepend to the form control. Useful to wrap the form control with HTML tags.
append
string
No
String to append to the form control. Useful to wrap the form control with HTML tags.
encode
any
No
true
Use this argument to decide whether the output of the function should be encoded in order to prevent Cross Site Scripting (XSS) attacks. Set it to true to encode all relevant output for the specific HTML element in question (e.g. tag content, attribute values, and URLs). For HTML elements that have both tag content and attribute values you can set this argument to attributes to only encode attribute values and not tag content.
Calculates the sum of values for a given property.
Uses the SQL function SUM.
If no records can be found to perform the calculation on you can use the ifNull argument to decide what should be returned.
Name
Type
Required
Default
Description
property
string
Yes
Name of the property to get the sum for (must be a property of a numeric data type).
where
string
No
Maps to the WHERE clause of the query (or HAVING when necessary). The following operators are supported: =, !=, <>, <, <=, >, >=, LIKE, NOT LIKE, IN, NOT IN, IS NULL, IS NOT NULL, AND, and OR (note that the key words need to be written in upper case). You can also use parentheses to group statements. Nested queries not allowed. You do not need to specify the table name(s); Wheels will do that for you.
include
string
No
Associations that should be included in the query using INNER or LEFT OUTER joins (which join type that is used depends on how the association has been set up in your model). If all included associations are set on the current model, you can specify them in a list (e.g. department,addresses,emails). You can build more complex include strings by using parentheses when the association is set on an included model, like album(artist(genre)), for example. These complex include strings only work when returnAs is set to query though.
distinct
boolean
No
false
When true, SUM returns the sum of unique values only.
parameterize
any
No
true
Set to true to use cfqueryparam on all columns, or pass in a list of property names to use cfqueryparam on those only.
ifNull
any
No
The value returned if no records are found. Common usage is to set this to 0 to make sure a numeric value is always returned instead of a blank string.
includeSoftDeletes
boolean
No
false
Set to true to include soft-deleted records in the queries that this method runs.
group
string
No
Maps to the GROUP BY clause of the query. You do not need to specify the table name(s); Wheels will do that for you.
Use this method to tell Wheels what database table to connect to for this model.
You only need to use this method when your table naming does not follow the standard Wheels convention of a singular object name mapping to a plural table name.
To not use a table for your model at all, call table(false).
Adds text columns to table definition.
In MySQL databases, you can specify different text sizes:
- Regular TEXT (65KB) - default when no size is specified
- MEDIUMTEXT (16MB) - specify size="mediumtext"
- LONGTEXT (4GB) - specify size="longtext"
For other database engines, the size parameter is ignored and the default text type is used.
Builds and returns a string containing a text area field form control based on the supplied objectName and property.
Note: Pass any additional arguments like class, rel, and id, and the generated tag will also include those values as HTML attributes.
Name
Type
Required
Default
Description
objectName
any
Yes
The variable name of the object to build the form control for.
property
string
Yes
The name of the property to use in the form control.
association
string
No
The name of the association that the property is located on. Used for building nested forms that work with nested properties. If you are building a form with deep nesting, simply pass in a list to the nested object, and Wheels will figure it out.
position
string
No
The position used when referencing a hasMany relationship in the association argument. Used for building nested forms that work with nested properties. If you are building a form with deep nestings, simply pass in a list of positions, and Wheels will figure it out.
label
string
No
useDefaultLabel
The label text to use in the form control.
labelPlacement
string
No
around
Whether to place the label before, after, or wrapped around the form control. Label text placement can be controlled using aroundLeft or aroundRight.
prepend
string
No
String to prepend to the form control. Useful to wrap the form control with HTML tags.
append
string
No
String to append to the form control. Useful to wrap the form control with HTML tags.
prependToLabel
string
No
String to prepend to the form control's label. Useful to wrap the form control with HTML tags.
appendToLabel
string
No
String to append to the form control's label. Useful to wrap the form control with HTML tags.
errorElement
string
No
span
HTML tag to wrap the form control with when the object contains errors.
errorClass
string
No
field-with-errors
The class name of the HTML tag that wraps the form control when there are errors.
encode
any
No
true
Use this argument to decide whether the output of the function should be encoded in order to prevent Cross Site Scripting (XSS) attacks. Set it to true to encode all relevant output for the specific HTML element in question (e.g. tag content, attribute values, and URLs). For HTML elements that have both tag content and attribute values you can set this argument to attributes to only encode attribute values and not tag content.
Builds and returns a string containing a text area form control based on the supplied name.
Note: Pass any additional arguments like class, rel, and id, and the generated tag will also include those values as HTML attributes.
Name
Type
Required
Default
Description
name
string
Yes
Name to populate in tag's name attribute.
content
string
No
Content to display in textarea on page load.
label
string
No
The label text to use in the form control.
labelPlacement
string
No
around
Whether to place the label before, after, or wrapped around the form control. Label text placement can be controlled using aroundLeft or aroundRight.
prepend
string
No
String to prepend to the form control. Useful to wrap the form control with HTML tags.
append
string
No
String to append to the form control. Useful to wrap the form control with HTML tags.
prependToLabel
string
No
String to prepend to the form control's label. Useful to wrap the form control with HTML tags.
appendToLabel
string
No
String to append to the form control's label. Useful to wrap the form control with HTML tags.
encode
any
No
true
Use this argument to decide whether the output of the function should be encoded in order to prevent Cross Site Scripting (XSS) attacks. Set it to true to encode all relevant output for the specific HTML element in question (e.g. tag content, attribute values, and URLs). For HTML elements that have both tag content and attribute values you can set this argument to attributes to only encode attribute values and not tag content.
Builds and returns a string containing a text field form control based on the supplied objectName and property.
Note: Pass any additional arguments like class, rel, and id, and the generated tag will also include those values as HTML attributes.
Name
Type
Required
Default
Description
objectName
any
Yes
The variable name of the object to build the form control for.
property
string
Yes
The name of the property to use in the form control.
association
string
No
The name of the association that the property is located on. Used for building nested forms that work with nested properties. If you are building a form with deep nesting, simply pass in a list to the nested object, and Wheels will figure it out.
position
string
No
The position used when referencing a hasMany relationship in the association argument. Used for building nested forms that work with nested properties. If you are building a form with deep nestings, simply pass in a list of positions, and Wheels will figure it out.
label
string
No
useDefaultLabel
The label text to use in the form control.
labelPlacement
string
No
around
Whether to place the label before, after, or wrapped around the form control. Label text placement can be controlled using aroundLeft or aroundRight.
prepend
string
No
String to prepend to the form control. Useful to wrap the form control with HTML tags.
append
string
No
String to append to the form control. Useful to wrap the form control with HTML tags.
prependToLabel
string
No
String to prepend to the form control's label. Useful to wrap the form control with HTML tags.
appendToLabel
string
No
String to append to the form control's label. Useful to wrap the form control with HTML tags.
errorElement
string
No
span
HTML tag to wrap the form control with when the object contains errors.
errorClass
string
No
field-with-errors
The class name of the HTML tag that wraps the form control when there are errors.
type
string
No
text
Input type attribute. Common examples in HTML5 and later are text (default), email, tel, and url.
encode
any
No
true
Use this argument to decide whether the output of the function should be encoded in order to prevent Cross Site Scripting (XSS) attacks. Set it to true to encode all relevant output for the specific HTML element in question (e.g. tag content, attribute values, and URLs). For HTML elements that have both tag content and attribute values you can set this argument to attributes to only encode attribute values and not tag content.
Builds and returns a string containing a text field form control based on the supplied name.
Note: Pass any additional arguments like class, rel, and id, and the generated tag will also include those values as HTML attributes.
Name
Type
Required
Default
Description
name
string
Yes
Name to populate in tag's name attribute.
value
string
No
Value to populate in tag's value attribute.
label
string
No
The label text to use in the form control.
labelPlacement
string
No
around
Whether to place the label before, after, or wrapped around the form control. Label text placement can be controlled using aroundLeft or aroundRight.
prepend
string
No
String to prepend to the form control. Useful to wrap the form control with HTML tags.
append
string
No
String to append to the form control. Useful to wrap the form control with HTML tags.
prependToLabel
string
No
String to prepend to the form control's label. Useful to wrap the form control with HTML tags.
appendToLabel
string
No
String to append to the form control's label. Useful to wrap the form control with HTML tags.
type
string
No
text
Input type attribute. Common examples in HTML5 and later are text (default), email, tel, and url.
encode
any
No
true
Use this argument to decide whether the output of the function should be encoded in order to prevent Cross Site Scripting (XSS) attacks. Set it to true to encode all relevant output for the specific HTML element in question (e.g. tag content, attribute values, and URLs). For HTML elements that have both tag content and attribute values you can set this argument to attributes to only encode attribute values and not tag content.
Builds and returns a string containing three select form controls for hour, minute, and second based on the supplied objectName and property.
Name
Type
Required
Default
Description
objectName
any
No
The variable name of the object to build the form control for.
property
string
No
The name of the property to use in the form control.
association
string
No
The name of the association that the property is located on. Used for building nested forms that work with nested properties. If you are building a form with deep nesting, simply pass in a list to the nested object, and Wheels will figure it out.
position
string
No
The position used when referencing a hasMany relationship in the association argument. Used for building nested forms that work with nested properties. If you are building a form with deep nestings, simply pass in a list of positions, and Wheels will figure it out.
order
string
No
hour,minute,second
Use to change the order of or exclude time select tags.
separator
string
No
:
Use to change the character that is displayed between the time select tags.
minuteStep
numeric
No
1
Pass in 10 to only show minute 10, 20, 30, etc.
secondStep
numeric
No
1
Pass in 10 to only show seconds 10, 20, 30, etc.
includeBlank
any
No
false
Whether to include a blank option in the select form control. Pass true to include a blank line or a string that should represent what display text should appear for the empty value (for example, "- Select One -").
label
string
No
false
The label text to use in the form control.
labelPlacement
string
No
around
Whether to place the label before, after, or wrapped around the form control. Label text placement can be controlled using aroundLeft or aroundRight.
prepend
string
No
String to prepend to the form control. Useful to wrap the form control with HTML tags.
append
string
No
String to append to the form control. Useful to wrap the form control with HTML tags.
prependToLabel
string
No
String to prepend to the form control's label. Useful to wrap the form control with HTML tags.
appendToLabel
string
No
String to append to the form control's label. Useful to wrap the form control with HTML tags.
errorElement
string
No
span
HTML tag to wrap the form control with when the object contains errors.
errorClass
string
No
field-with-errors
The class name of the HTML tag that wraps the form control when there are errors.
combine
boolean
No
Set to false to not combine the select parts into a single DateTime object.
twelveHour
boolean
No
false
whether to display the hours in 24 or 12 hour format. 12 hour format has AM/PM drop downs
encode
any
No
true
Use this argument to decide whether the output of the function should be encoded in order to prevent Cross Site Scripting (XSS) attacks. Set it to true to encode all relevant output for the specific HTML element in question (e.g. tag content, attribute values, and URLs). For HTML elements that have both tag content and attribute values you can set this argument to attributes to only encode attribute values and not tag content.
Builds and returns a string containing three select form controls for hour, minute, and second based on name.
Name
Type
Required
Default
Description
name
string
Yes
Name to populate in tag's name attribute.
selected
string
No
Value of option that should be selected by default.
order
string
No
hour,minute,second
Use to change the order of or exclude time select tags.
separator
string
No
:
Use to change the character that is displayed between the time select tags.
minuteStep
numeric
No
1
Pass in 10 to only show minute 10, 20, 30, etc.
secondStep
numeric
No
1
Pass in 10 to only show seconds 10, 20, 30, etc.
includeBlank
any
No
false
Whether to include a blank option in the select form control. Pass true to include a blank line or a string that should represent what display text should appear for the empty value (for example, "- Select One -").
label
string
No
The label text to use in the form control.
labelPlacement
string
No
around
Whether to place the label before, after, or wrapped around the form control. Label text placement can be controlled using aroundLeft or aroundRight.
prepend
string
No
String to prepend to the form control. Useful to wrap the form control with HTML tags.
append
string
No
String to append to the form control. Useful to wrap the form control with HTML tags.
prependToLabel
string
No
String to prepend to the form control's label. Useful to wrap the form control with HTML tags.
appendToLabel
string
No
String to append to the form control's label. Useful to wrap the form control with HTML tags.
combine
boolean
No
Set to false to not combine the select parts into a single DateTime object.
twelveHour
boolean
No
false
whether to display the hours in 24 or 12 hour format. 12 hour format has AM/PM drop downs
encode
any
No
true
Use this argument to decide whether the output of the function should be encoded in order to prevent Cross Site Scripting (XSS) attacks. Set it to true to encode all relevant output for the specific HTML element in question (e.g. tag content, attribute values, and URLs). For HTML elements that have both tag content and attribute values you can set this argument to attributes to only encode attribute values and not tag content.
Assigns to the property specified the opposite of the property's current boolean value.
Throws an error if the property cannot be converted to a boolean value.
Returns this object if save called internally is false.
Name
Type
Required
Default
Description
property
string
Yes
save
boolean
No
true
Argument to decide whether save the property after it has been toggled.
Migrates up: will be executed when migrating your schema forward
Along with down(), these are the two main functions in any migration file
Only available in a migration CFC
Updates the object with the supplied properties and saves it to the database.
Returns true if the object was saved successfully to the database and false otherwise.
Name
Type
Required
Default
Description
properties
struct
No
[runtime expression]
The properties you want to set on the object (can also be passed in as named arguments).
parameterize
any
No
true
Set to true to use cfqueryparam on all columns, or pass in a list of property names to use cfqueryparam on those only.
reload
boolean
No
false
Set to true to force Wheels to query the database even though an identical query for this model may have been run in the same request. (The default in Wheels is to get the second query from the model's request-level cache.)
validate
boolean
No
true
Set to false to skip validations for this operation.
transaction
string
No
[runtime expression]
Set this to commit to update the database, rollback to run all the database queries but not commit them, or none to skip transaction handling altogether.
callbacks
boolean
No
true
Set to false to disable callbacks for this method.
allowExplicitTimestamps
boolean
No
false
Set this to true to allow explicit assignment of createdAt or updatedAt properties
Updates all properties for the records that match the where argument.
Property names and values can be passed in either using named arguments or as a struct to the properties argument.
By default, objects will not be instantiated and therefore callbacks and validations are not invoked.
You can change this behavior by passing in instantiate=true.
This method returns the number of records that were updated.
Name
Type
Required
Default
Description
where
string
No
Maps to the WHERE clause of the query (or HAVING when necessary). The following operators are supported: =, !=, <>, <, <=, >, >=, LIKE, NOT LIKE, IN, NOT IN, IS NULL, IS NOT NULL, AND, and OR (note that the key words need to be written in upper case). You can also use parentheses to group statements. Nested queries not allowed. You do not need to specify the table name(s); Wheels will do that for you.
include
string
No
Associations that should be included in the query using INNER or LEFT OUTER joins (which join type that is used depends on how the association has been set up in your model). If all included associations are set on the current model, you can specify them in a list (e.g. department,addresses,emails). You can build more complex include strings by using parentheses when the association is set on an included model, like album(artist(genre)), for example. These complex include strings only work when returnAs is set to query though.
properties
struct
No
[runtime expression]
The properties you want to set on the object (can also be passed in as named arguments).
reload
boolean
No
false
Set to true to force Wheels to query the database even though an identical query for this model may have been run in the same request. (The default in Wheels is to get the second query from the model's request-level cache.)
parameterize
any
No
true
Set to true to use cfqueryparam on all columns, or pass in a list of property names to use cfqueryparam on those only.
instantiate
boolean
No
false
Whether or not to instantiate the object(s) first. When objects are not instantiated, any callbacks and validations set on them will be skipped.
useIndex
struct
No
[runtime expression]
If you want to specify table index hints, pass in a structure of index names using your model names as the structure keys. Eg: {user="idx_users", post="idx_posts"}. This feature is only supported by MySQL and SQL Server.
validate
boolean
No
true
Set to false to skip validations for this operation.
transaction
string
No
[runtime expression]
Set this to commit to update the database, rollback to run all the database queries but not commit them, or none to skip transaction handling altogether.
callbacks
boolean
No
true
Set to false to disable callbacks for this method.
includeSoftDeletes
boolean
No
false
Set to true to include soft-deleted records in the queries that this method runs.
Finds the object with the supplied key and saves it (if validation permits it) with the supplied properties and / or named arguments.
Property names and values can be passed in either using named arguments or as a struct to the properties argument.
Returns true if the object was found and updated successfully, false otherwise.
Name
Type
Required
Default
Description
key
any
Yes
Primary key value(s) of the record to fetch. Separate with comma if passing in multiple primary key values. Accepts a string, list, or a numeric value.
properties
struct
No
[runtime expression]
The properties you want to set on the object (can also be passed in as named arguments).
reload
boolean
No
false
Set to true to force Wheels to query the database even though an identical query for this model may have been run in the same request. (The default in Wheels is to get the second query from the model's request-level cache.)
validate
boolean
No
true
Set to false to skip validations for this operation.
transaction
string
No
[runtime expression]
Set this to commit to update the database, rollback to run all the database queries but not commit them, or none to skip transaction handling altogether.
callbacks
boolean
No
true
Set to false to disable callbacks for this method.
includeSoftDeletes
boolean
No
false
Set to true to include soft-deleted records in the queries that this method runs.
Gets an object based on the arguments used and updates it with the supplied properties.
Returns true if an object was found and updated successfully, false otherwise.
Name
Type
Required
Default
Description
where
string
No
Maps to the WHERE clause of the query (or HAVING when necessary). The following operators are supported: =, !=, <>, <, <=, >, >=, LIKE, NOT LIKE, IN, NOT IN, IS NULL, IS NOT NULL, AND, and OR (note that the key words need to be written in upper case). You can also use parentheses to group statements. Nested queries not allowed. You do not need to specify the table name(s); Wheels will do that for you.
order
string
No
Maps to the ORDER BY clause of the query. You do not need to specify the table name(s); Wheels will do that for you.
properties
struct
No
[runtime expression]
The properties you want to set on the object (can also be passed in as named arguments).
reload
boolean
No
false
Set to true to force Wheels to query the database even though an identical query for this model may have been run in the same request. (The default in Wheels is to get the second query from the model's request-level cache.)
validate
boolean
No
true
Set to false to skip validations for this operation.
useIndex
struct
No
[runtime expression]
If you want to specify table index hints, pass in a structure of index names using your model names as the structure keys. Eg: {user="idx_users", post="idx_posts"}. This feature is only supported by MySQL and SQL Server.
transaction
string
No
[runtime expression]
Set this to commit to update the database, rollback to run all the database queries but not commit them, or none to skip transaction handling altogether.
callbacks
boolean
No
true
Set to false to disable callbacks for this method.
Updates a single property and saves the record without going through the normal validation procedure.
This is especially useful for boolean flags on existing records.
Name
Type
Required
Default
Description
property
string
No
Name of the property to update the value for globally.
value
any
No
Value to set on the given property globally.
parameterize
any
No
true
Set to true to use cfqueryparam on all columns, or pass in a list of property names to use cfqueryparam on those only.
transaction
string
No
[runtime expression]
Set this to commit to update the database, rollback to run all the database queries but not commit them, or none to skip transaction handling altogether.
callbacks
boolean
No
true
Set to false to disable callbacks for this method.
Creates an internal URL based on supplied arguments.
Name
Type
Required
Default
Description
route
string
No
Name of a route that you have configured in config/routes.cfm.
controller
string
No
Name of the controller to include in the URL.
action
string
No
Name of the action to include in the URL.
key
any
No
Key(s) to include in the URL.
params
string
No
Any additional parameters to be set in the query string (example: wheels=cool&x=y). Please note that Wheels uses the & and = characters to split the parameters and encode them properly for you. However, if you need to pass in & or = as part of the value, then you need to encode them (and only them), example: a=cats%26dogs%3Dtrouble!&b=1.
anchor
string
No
Sets an anchor name to be appended to the path.
onlyPath
boolean
No
true
If true, returns only the relative URL (no protocol, host name or port).
host
string
No
Set this to override the current host.
protocol
string
No
Set this to override the current protocol.
port
numeric
No
0
Set this to override the current port number.
encode
boolean
No
true
Encode URL parameters using EncodeForURL(). Please note that this does not make the string safe for placement in HTML attributes, for that you need to wrap the result in EncodeForHtmlAttribute() or use linkTo(), startFormTag() etc instead.
Runs the validation on the object and returns true if it passes it.
Wheels will run the validation process automatically whenever an object is saved to the database, but sometimes it's useful to be able to run this method to see if the object is valid without saving it to the database.
Name
Type
Required
Default
Description
callbacks
boolean
No
true
Set to false to disable callbacks for this method.
Validates that the value of the specified property also has an identical confirmation value.
This is common when having a user type in their email address a second time to confirm, confirming a password by typing it a second time, etc.
The confirmation value only exists temporarily and never gets saved to the database.
By convention, the confirmation property has to be named the same as the property with "Confirmation" appended at the end.
Using the password example, to confirm our password property, we would create a property called passwordConfirmation.
Name
Type
Required
Default
Description
properties
string
No
Name of property or list of property names to validate against (can also be called with the property argument).
message
string
No
[property] should match confirmation
Supply a custom error message here to override the built-in one.
when
string
No
onSave
Pass in onCreate or onUpdate to limit when this validation occurs (by default validation will occur on both create and update, i.e. onSave).
condition
string
No
String expression to be evaluated that decides if validation will be run (if the expression returns true validation will run).
unless
string
No
String expression to be evaluated that decides if validation will be run (if the expression returns false validation will run).
caseSensitive
boolean
No
false
Ensure the confirmed property comparison is case sensitive
Validates that the value of the specified property does not exist in the supplied list.
Name
Type
Required
Default
Description
properties
string
No
Name of property or list of property names to validate against (can also be called with the property argument).
list
string
Yes
Single value or list of values that should not be allowed.
message
string
No
[property] is reserved
Supply a custom error message here to override the built-in one.
when
string
No
onSave
Pass in onCreate or onUpdate to limit when this validation occurs (by default validation will occur on both create and update, i.e. onSave).
allowBlank
boolean
No
false
If set to true, validation will be skipped if the property value is an empty string or doesn't exist at all. This is useful if you only want to run this validation after it passes the validatesPresenceOf test, thus avoiding duplicate error messages if it doesn't.
condition
string
No
String expression to be evaluated that decides if validation will be run (if the expression returns true validation will run).
unless
string
No
String expression to be evaluated that decides if validation will be run (if the expression returns false validation will run).
Validates that the value of the specified property is formatted correctly by matching it against a regular expression using the regEx argument and / or against a built-in CFML validation type using the type argument (creditcard, date, email, etc.).
Name
Type
Required
Default
Description
properties
string
No
Name of property or list of property names to validate against (can also be called with the property argument).
regEx
string
No
Regular expression to verify against.
type
string
No
One of the following types to verify against: creditcard, date, email, eurodate, guid, social_security_number, ssn, telephone, time, URL, USdate, UUID, variableName, zipcode (will be passed through to your CFML engine's IsValid() function).
message
string
No
[property] is invalid
Supply a custom error message here to override the built-in one.
when
string
No
onSave
Pass in onCreate or onUpdate to limit when this validation occurs (by default validation will occur on both create and update, i.e. onSave).
allowBlank
boolean
No
false
If set to true, validation will be skipped if the property value is an empty string or doesn't exist at all. This is useful if you only want to run this validation after it passes the validatesPresenceOf test, thus avoiding duplicate error messages if it doesn't.
condition
string
No
String expression to be evaluated that decides if validation will be run (if the expression returns true validation will run).
unless
string
No
String expression to be evaluated that decides if validation will be run (if the expression returns false validation will run).
Validates that the value of the specified property exists in the supplied list.
Name
Type
Required
Default
Description
properties
string
No
Name of property or list of property names to validate against (can also be called with the property argument).
list
string
Yes
List of allowed values.
message
string
No
[property] is not included in the list
Supply a custom error message here to override the built-in one.
when
string
No
onSave
Pass in onCreate or onUpdate to limit when this validation occurs (by default validation will occur on both create and update, i.e. onSave).
allowBlank
boolean
No
false
If set to true, validation will be skipped if the property value is an empty string or doesn't exist at all. This is useful if you only want to run this validation after it passes the validatesPresenceOf test, thus avoiding duplicate error messages if it doesn't.
condition
string
No
String expression to be evaluated that decides if validation will be run (if the expression returns true validation will run).
unless
string
No
String expression to be evaluated that decides if validation will be run (if the expression returns false validation will run).
Validates that the value of the specified property matches the length requirements supplied.
Use the exactly, maximum, minimum and within arguments to specify the length requirements.
Name
Type
Required
Default
Description
properties
string
No
Name of property or list of property names to validate against (can also be called with the property argument).
message
string
No
[property] is the wrong length
Supply a custom error message here to override the built-in one.
when
string
No
onSave
Pass in onCreate or onUpdate to limit when this validation occurs (by default validation will occur on both create and update, i.e. onSave).
allowBlank
boolean
No
false
If set to true, validation will be skipped if the property value is an empty string or doesn't exist at all. This is useful if you only want to run this validation after it passes the validatesPresenceOf test, thus avoiding duplicate error messages if it doesn't.
exactly
numeric
No
0
The exact length that the property value must be.
maximum
numeric
No
0
The maximum length that the property value can be.
minimum
numeric
No
0
The minimum length that the property value can be.
within
string
No
A list of two values (minimum and maximum) that the length of the property value must fall within.
condition
string
No
String expression to be evaluated that decides if validation will be run (if the expression returns true validation will run).
unless
string
No
String expression to be evaluated that decides if validation will be run (if the expression returns false validation will run).
Validates that the value of the specified property is numeric.
Name
Type
Required
Default
Description
properties
string
No
Name of property or list of property names to validate against (can also be called with the property argument).
message
string
No
[property] is not a number
Supply a custom error message here to override the built-in one.
when
string
No
onSave
Pass in onCreate or onUpdate to limit when this validation occurs (by default validation will occur on both create and update, i.e. onSave).
allowBlank
boolean
No
false
If set to true, validation will be skipped if the property value is an empty string or doesn't exist at all. This is useful if you only want to run this validation after it passes the validatesPresenceOf test, thus avoiding duplicate error messages if it doesn't.
onlyInteger
boolean
No
false
Specifies whether the property value must be an integer.
condition
string
No
String expression to be evaluated that decides if validation will be run (if the expression returns true validation will run).
unless
string
No
String expression to be evaluated that decides if validation will be run (if the expression returns false validation will run).
odd
boolean
No
even
boolean
No
greaterThan
numeric
No
Specifies whether or not the value must be greater than the supplied value.
greaterThanOrEqualTo
numeric
No
Specifies whether or not the value must be greater than or equal the supplied value.
equalTo
numeric
No
Specifies whether or not the value must be equal to the supplied value.
lessThan
numeric
No
Specifies whether or not the value must be less than the supplied value.
lessThanOrEqualTo
numeric
No
Specifies whether or not the value must be less than or equal the supplied value.
Validates that the value of the specified property is unique in the database table.
Useful for ensuring that two users can't sign up to a website with identical usernames for example.
When a new record is created, a check is made to make sure that no record already exists in the database table with the given value for the specified property.
When the record is updated, the same check is made but disregarding the record itself.
Name
Type
Required
Default
Description
properties
string
No
Name of property or list of property names to validate against (can also be called with the property argument).
message
string
No
[property] has already been taken
Supply a custom error message here to override the built-in one.
when
string
No
onSave
Pass in onCreate or onUpdate to limit when this validation occurs (by default validation will occur on both create and update, i.e. onSave).
allowBlank
boolean
No
false
If set to true, validation will be skipped if the property value is an empty string or doesn't exist at all. This is useful if you only want to run this validation after it passes the validatesPresenceOf test, thus avoiding duplicate error messages if it doesn't.
scope
string
No
One or more properties by which to limit the scope of the uniqueness constraint.
condition
string
No
String expression to be evaluated that decides if validation will be run (if the expression returns true validation will run).
unless
string
No
String expression to be evaluated that decides if validation will be run (if the expression returns false validation will run).
includeSoftDeletes
boolean
No
true
Set to true to include soft-deleted records in the queries that this method runs.
Instructs Wheels to verify that some specific criteria are met before running an action.
Note that all undeclared arguments will be passed to redirectTo() call if a handler is not specified.
Name
Type
Required
Default
Description
only
string
No
List of action names to limit this verification to.
except
string
No
List of action names to exclude this verification from.
post
any
No
Set to true to verify that this is a POST request.
get
any
No
Set to true to verify that this is a GET request.
ajax
any
No
Set to true to verify that this is an AJAX request.
cookie
string
No
Verify that the passed in variable name exists in the cookie scope.
session
string
No
Verify that the passed in variable name exists in the session scope.
params
string
No
Verify that the passed in variable name exists in the params struct.
handler
string
No
Pass in the name of a function that should handle failed verifications. The default is to just abort the request when a verification fails.
cookieTypes
string
No
List of types to check each listed cookie value against (will be passed through to your CFML engine's IsValid function).
sessionTypes
string
No
List of types to check each list session value against (will be passed through to your CFML engine's IsValid function).
paramsTypes
string
No
List of types to check each params value against (will be passed through to your CFML engine's IsValid function).
List of HTTP methods (verbs) to generate the wildcard routes for. We strongly recommend leaving the default value of get and using other routing mappers if you need to POST to a URL endpoint. For better readability, you can also pass this argument as methods if you're listing multiple methods.
action
string
No
index
Default action to specify if the value for the [action] placeholder is not provided.
mapKey
boolean
No
false
Whether or not to enable a [key] matcher, enabling a [controller]/[action]/[key] pattern.
mapFormat
boolean
No
false
Whether or not to add an optional .[format] pattern to the end of the generated routes. This is useful for providing formats via URL like json, xml, pdf, etc.
Builds and returns a string containing a select form control for a range of years based on the supplied name.
Name
Type
Required
Default
Description
name
string
Yes
Name to populate in tag's name attribute.
selected
string
No
The year that should be selected initially.
startYear
numeric
No
2021
First year in select list.
endYear
numeric
No
2031
Last year in select list.
includeBlank
any
No
false
Whether to include a blank option in the select form control. Pass true to include a blank line or a string that should represent what display text should appear for the empty value (for example, "- Select One -").
label
string
No
The label text to use in the form control.
labelPlacement
string
No
around
Whether to place the label before, after, or wrapped around the form control. Label text placement can be controlled using aroundLeft or aroundRight.
prepend
string
No
String to prepend to the form control. Useful to wrap the form control with HTML tags.
append
string
No
String to append to the form control. Useful to wrap the form control with HTML tags.
prependToLabel
string
No
String to prepend to the form control's label. Useful to wrap the form control with HTML tags.
appendToLabel
string
No
String to append to the form control's label. Useful to wrap the form control with HTML tags.
encode
any
No
true
Use this argument to decide whether the output of the function should be encoded in order to prevent Cross Site Scripting (XSS) attacks. Set it to true to encode all relevant output for the specific HTML element in question (e.g. tag content, attribute values, and URLs). For HTML elements that have both tag content and attribute values you can set this argument to attributes to only encode attribute values and not tag content.