Skip to content

Miscellaneous

Miscellaneous

  • accessibleProperties() — Use this method to specify which properties can be set through mass assignment.
  • addDefaultRoutes() — Adds the default CFWheels routes (for example, [controller]/[action]/[key], etc.) to your application. Only use this met
  • addError() — Adds an error on a specific property.
  • addErrorToBase() — Adds an error on a specific property.
  • addFormat() — Adds a new MIME format to your Wheels application for use with responding to multiple formats.
  • addRoute() — Adds a new route to your application.
  • afterCreate() — Registers method(s) that should be called after a new object is created.
  • afterDelete() — Registers method(s) that should be called after an object is deleted.
  • afterFind() — Registers method(s) that should be called after an existing object has been initialized (which is usually done with the
  • afterInitialization() — Registers method(s) that should be called after an object has been initialized.
  • afterNew() — Registers method(s) that should be called after a new object has been initialized (which is usually done with the new me
  • afterSave() — Registers method(s) that should be called after an object is saved.
  • afterUpdate() — Registers method(s) that should be called after an existing object is updated.
  • afterValidation() — Registers method(s) that should be called after an object is validated.
  • afterValidationOnCreate() — Registers method(s) that should be called after a new object is validated.
  • afterValidationOnUpdate() — Registers method(s) that should be called after an existing object is validated.
  • allChanges() — Returns a struct detailing all changes that have been made on the object but not yet saved to the database.
  • allErrors() — Returns an array of all the errors on the object.
  • autoLink() — Turns all URLs and email addresses into hyperlinks.
  • automaticValidations() — Whether or not to enable default validations for this model.
  • average() — Calculates the average value for a given property. Uses the SQL function AVG. If no records can be found to perform the
  • beforeCreate() — Registers method(s) that should be called before a new object is created.
  • beforeDelete() — Registers method(s) that should be called before an object is deleted.
  • beforeSave() — Registers method(s) that should be called before an object is saved.
  • beforeUpdate() — Registers method(s) that should be called before an existing object is updated.
  • beforeValidation() — Registers method(s) that should be called before an object is validated.
  • beforeValidationOnCreate() — Registers method(s) that should be called before a new object is validated.
  • beforeValidationOnUpdate() — Registers method(s) that should be called before an existing object is validated.
  • belongsTo() — Sets up a belongsTo association between this model and the specified one. Use this association when this model contains
  • buttonTag() — Builds and returns a string containing a button form control.
  • buttonTo() — Creates a form containing a single button that submits to the URL. The URL is built the same way as the linkTo function.
  • caches() — Tells CFWheels to cache one or more actions.
  • capitalize() — Returns the text with the first character converted to uppercase.
  • changedFrom() — Returns the previous value of a property that has changed. Returns an empty string if no previous value exists. Wheels w
  • changedProperties() — Returns a list of the object properties that have been changed but not yet saved to the database.
  • checkBox() — Builds and returns a string containing a check box form control based on the supplied objectName and property. In most c
  • checkBoxTag() — Builds and returns a string containing a check box form control based on the supplied name. Note: Pass any additional ar
  • clearChangeInformation() — Clears all internal knowledge of the current state of the object.
  • clearErrors() — Clears out all errors set on the object or only the ones set for a specific property or name.
  • columnDataForProperty() — Returns a struct with data for the named property.
  • columnForProperty() — Returns the column name mapped for the named model property.
  • columnNames() — Returns a list of column names in the table mapped to this model. The list is ordered according to the columns’ ordinal
  • columns() — Returns an array of columns names for the table associated with this class. Does not include calculated properties that
  • compareTo() — Pass in another Wheels model object to see if the two objects are the same.
  • contentFor() — Used to store a section’s output for rendering within a layout. This content store acts as a stack, so you can store mul
  • contentForLayout() — Includes content for the body section, which equates to the output generated by the view template run by the request.
  • controller() — Creates and returns a controller object with your own custom name and params. Used primarily for testing purposes.
  • count() — Returns the number of rows that match the arguments (or all rows if no arguments are passed in). Uses the SQL function C
  • create() — Creates a new object, saves it to the database (if the validation permits it), and returns it. If the validation fails,
  • cycle() — Cycles through list values every time it is called.
  • dataSource() — Use this method to override the data source connection information for this model.
  • dateSelect() — Builds and returns a string containing three select form controls for month, day, and year based on the supplied objectN
  • dateSelectTags() — Builds and returns a string containing three select form controls (month, day, and year) based on a name and value.
  • dateTimeSelect() — Builds and returns a string containing six select form controls (three for date selection and the remaining three for ti
  • dateTimeSelectTags() — Builds and returns a string containing six select form controls (three for date selection and the remaining three for ti
  • daySelectTag() — Builds and returns a string containing a select form control for the days of the week based on the supplied name.
  • delete() — Deletes the object, which means the row is deleted from the database (unless prevented by a beforeDelete callback). Retu
  • deleteAll() — Deletes all records that match the where argument. By default, objects will not be instantiated and therefore callbacks
  • deleteByKey() — Finds the record with the supplied key and deletes it. Returns true on successful deletion of the row, false otherwise.
  • deleteOne() — Gets an object based on conditions and deletes it.
  • deobfuscateParam() — Deobfuscates a value.
  • distanceOfTimeInWords() — Pass in two dates to this method, and it will return a string describing the difference between them.
  • endFormTag() — Builds and returns a string containing the closing form tag.
  • errorCount() — Returns the number of errors this object has associated with it. Specify property or name if you wish to count only spec
  • errorMessageOn() — Returns the error message, if one exists, on the object’s property. If multiple error messages exist, the first one is r
  • errorMessagesFor() — Builds and returns a list (ul tag with a default class of errorMessages) containing all the error messages for all the p
  • errorsOn() — Returns an array of all errors associated with the supplied property (and error name if passed in).
  • errorsOnBase() — Returns an array of all errors associated with the object as a whole (not related to any specific property).
  • excerpt() — Extracts an excerpt from text that matches the first instance of a given phrase.
  • exists() — 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 th
  • fileField() — Builds and returns a string containing a file field form control based on the supplied objectName and property. Note: Pa
  • fileFieldTag() — Builds and returns a string containing a file form control based on the supplied name. Note: Pass any additional argumen
  • filterChain() — Returns an array of all the filters set on this controller in the order in which they will be executed.
  • filters() — Tells CFWheels to run a function before an action is run or after an action has been run. You can also specify multiple
  • findAll() — Returns records from the database table mapped to this model according to the arguments passed in (use the where argumen
  • findAllKeys() — Returns all primary key values in a list. In addition to quoted and delimiter you can pass in any argument that findAll(
  • findByKey() — Fetches the requested record by primary key and returns it as an object. Returns false if no record is found. You can ov
  • findFirst() — Fetches the first record ordered by primary key value. Use the property argument to order by something else. Returns a m
  • findLast() — Fetches the last record ordered by primary key value. Use the property argument to order by something else. Returns a mo
  • findOne() — Fetches the first record found based on the WHERE and ORDER BY clauses. With the default settings (i.e. the returnAs arg
  • findOrCreateBy[Property]() — Returns the object or creates a new one if it wasn’t found.
  • flash() — Returns the value of a specific key in the Flash (or the entire Flash as a struct if no key is passed in).
  • flashClear() — Deletes everything from the Flash.
  • flashCount() — Returns how many keys exist in the Flash.
  • flashDelete() — Deletes a specific key from the Flash. Returns true if the key exists.
  • flashInsert() — Inserts a new key / value into the Flash.
  • flashIsEmpty() — Returns whether or not the Flash is empty.
  • flashKeep() — Make the entire Flash or specific key in it stick around for one more request.
  • flashKeyExists() — Checks if a specific key exists in the Flash.
  • flashMessages() — Displays a marked-up listing of messages that exist in the Flash.
  • get() — Returns the current setting for the supplied Wheels setting or the current default for the supplied Wheels function argu
  • getTableNamePrefix() — Returns the table name prefix set for the table.
  • hasChanged() — Returns true if the specified property (or any if none was passed in) has been changed but not yet saved to the database
  • hasErrors() — Returns true if the object has any errors. You can also limit to only check a specific property or name for errors.
  • hasMany() — Sets up a hasMany association between this model and the specified one.
  • hasManyCheckBox() — Used as a shortcut to output the proper form elements for an association. Note: Pass any additional arguments like class
  • hasManyRadioButton() — Used as a shortcut to output the proper form elements for an association. Note: Pass any additional arguments like class
  • hasOne() — Sets up a hasOne association between this model and the specified one.
  • hasProperty() — Returns true if the specified property name exists on the model.
  • hiddenField() — Builds and returns a string containing a hidden field form control based on the supplied objectName and property. Note:
  • hiddenFieldTag() — Builds and returns a string containing a hidden field form control based on the supplied name. Note: Pass any additional
  • highlight() — Highlights the phrase(s) everywhere in the text if found by wrapping it in a span tag.
  • hourSelectTag() — Builds and returns a string containing one select form control for the hours of the day based on the supplied name.
  • humanize() — Returns readable text by capitalizing and converting camel casing to multiple words.
  • hyphenize() — Converts camelCase strings to lowercase strings with hyphens as word delimiters instead. Example: myVariable becomes my-
  • imageTag() — Returns an img tag. If the image is stored in the local images folder, the tag will also set the width, height, and alt
  • includeContent() — Used to output the content for a particular section in a layout.
  • includedInObject() — Used as a shortcut to check if the specified IDs are a part of the main form object. This method should only be used for
  • includeLayout() — Includes the contents of another layout file. This is usually used to include a parent layout from within a child layout
  • includePartial() — Includes the specified partial file in the view. Similar to using cfinclude but with the ability to cache the result and
  • invokeWithTransaction() — Runs the specified method within a single database transaction.
  • isAjax() — Returns whether the page was called from JavaScript or not.
  • isClass() — Use this method within a model’s method to check whether you are currently in a class-level object.
  • isGet() — Returns whether the request was a normal GET request or not.
  • isInstance() — Use this method to check whether you are currently in an instance object.
  • isNew() — Returns true if this object hasn’t been saved yet. (In other words, no matching record exists in the database yet.) Retu
  • isPost() — Returns whether the request came from a form POST submission or not.
  • isSecure() — Returns whether CFWheels is communicating over a secure port.
  • javaScriptIncludeTag() — Returns a script tag for a JavaScript file (or several) based on the supplied arguments.
  • key() — Returns the value of the primary key for the object. If you have a single primary key named id, then someObject.key() is
  • linkTo() — Creates a link to another page in your application. Pass in the name of a route to use your configured routes or a contr
  • mailTo() — Creates a mailto link tag to the specified email address, which is also used as the name of the link unless name is spec
  • maximum() — Calculates the maximum value for a given property. Uses the SQL function MAX. If no records can be found to perform the
  • mimeTypes() — Returns an associated MIME type based on a file extension.
  • minimum() — Calculates the minimum value for a given property. Uses the SQL function MIN. If no records can be found to perform the
  • minuteSelectTag() — Builds and returns a string containing one select form control for the minutes of an hour based on the supplied name.
  • model() — Returns a reference to the requested model so that class level methods can be called on it.
  • monthSelectTag() — Builds and returns a string containing a select form control for the months of the year based on the supplied name.
  • nestedProperties() — Allows for nested objects, structs, and arrays to be set from params and other generated data.
  • new() — Creates a new object based on supplied properties and returns it. The object is not saved to the database; it only exist
  • obfuscateParam() — Obfuscates a value. Typically used for hiding primary key values when passed along in the URL.
  • onlyProvides() — Use this in an individual controller action to define which formats the action will respond with. This can be used to de
  • pagination() — Returns a struct with information about the specificed paginated query. The keys that will be included in the struct are
  • paginationLinks() — Builds and returns a string containing links to pages based on a paginated query. Uses linkTo() internally to build the
  • passwordField() — Builds and returns a string containing a password field form control based on the supplied objectName and property. Note
  • passwordFieldTag() — Builds and returns a string containing a password field form control based on the supplied name. Note: Pass any addition
  • pluginNames() — Returns a list of all installed plugins’ names.
  • pluralize() — Returns the plural form of the passed in word. Can also pluralize a word based on a value passed to the count argument.
  • primaryKey() — Returns the name of the primary key for this model’s table. This is determined through database introspection. If compos
  • primaryKeys() — Alias for primaryKey(). Use this for better readability when you’re accessing multiple primary keys.
  • properties() — Returns a structure of all the properties with their names as keys and the values of the property as values.
  • property() — Use this method to map an object property to either a table column with a different name than the property or to a SQL e
  • propertyIsPresent() — Returns true if the specified property exists on the model and is not a blank string.
  • propertyNames() — Returns a list of property names ordered by their respective column’s ordinal position in the database table. Also inclu
  • protectedProperties() — Use this method to specify which properties cannot be set through mass assignment.
  • provides() — Defines formats that the controller will respond with upon request. The format can be requested through a URL variable c
  • radioButton() — Builds and returns a string containing a radio button form control based on the supplied objectName and property. Note:
  • radioButtonTag() — Builds and returns a string containing a radio button form control based on the supplied name. Note: Pass any additional
  • redirectTo() — Redirects the browser to the supplied controller/action/key, route or back to the referring page. Internally, this funct
  • reload() — Reloads the property values of this object from the database.
  • renderNothing() — Instructs the controller to render an empty string when it’s finished processing the action. This is very similar to cal
  • renderPage() — Instructs the controller which view template and layout to render when it’s finished processing the action. Note that wh
  • renderPartial() — Instructs the controller to render a partial when it’s finished processing the action.
  • renderText() — Instructs the controller to render specified text when it’s finished processing the action.
  • renderWith() — Instructs the controller to render the data passed in to the format that is requested. If the format requested is json o
  • resetCycle() — Resets a cycle so that it starts from the first list value the next time it is called.
  • response() — Returns content that CFWheels will send to the client in response to the request.
  • save() — Saves the object if it passes validation and callbacks. Returns true if the object was saved successfully to the databas
  • secondSelectTag() — Builds and returns a string containing one select form control for the seconds of a minute based on the supplied name.
  • select() — Builds and returns a string containing a select form control based on the supplied objectName and property. Note: Pass a
  • selectTag() — Builds and returns a string containing a select form control based on the supplied name and options. Note: Pass any addi
  • sendEmail() — Sends an email using a template and an optional layout to wrap it in. Besides the CFWheels-specific arguments documented
  • sendFile() — Sends a file to the user (from the files folder or a path relative to it by default).
  • set() — Use to configure a global setting or set a default for a function.
  • setFilterChain() — Use this function if you need a more low level way of setting the entire filter chain for a controller.
  • setPagination() — Allows you to set a pagination handle for a custom query so you can perform pagination on it in your view with paginatio
  • setPrimaryKey() — 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 defini
  • setPrimaryKeys() — Alias for setPrimaryKey(). Use this for better readability when you’re setting multiple properties as the primary key.
  • setProperties() — Allows you to set all the properties of an object at once by passing in a structure with keys matching the property name
  • setResponse() — Sets content that CFWheels will send to the client in response to the request.
  • setTableNamePrefix() — Sets a prefix to prepend to the table name when this model runs SQL queries.
  • setVerificationChain() — Use this function if you need a more low level way of setting the entire verification chain for a controller.
  • simpleFormat() — Replaces single newline characters with HTML break tags and double newline characters with HTML paragraph tags (properly
  • singularize() — Returns the singular form of the passed in word.
  • startFormTag() — Builds and returns a string containing the opening form tag. The form’s action will be built according to the same rules
  • stripLinks() — Removes all links from an HTML string, leaving just the link text.
  • stripTags() — Removes all HTML tags from a string.
  • styleSheetLinkTag() — Returns a link tag for a stylesheet (or several) based on the supplied arguments.
  • submitTag() — Builds and returns a string containing a submit button form control. Note: Pass any additional arguments like class, rel
  • sum() — Calculates the sum of values for a given property. Uses the SQL function SUM. If no records can be found to perform the
  • table() — Use this method to tell Wheels what database table to connect to for this model. You only need to use this method when y
  • tableName() — Returns the name of the database table that this model is mapped to.
  • textArea() — Builds and returns a string containing a text area field form control based on the supplied objectName and property. Not
  • textAreaTag() — Builds and returns a string containing a text area form control based on the supplied name. Note: Pass any additional ar
  • textField() — Builds and returns a string containing a text field form control based on the supplied objectName and property. Note: Pa
  • textFieldTag() — Builds and returns a string containing a text field form control based on the supplied name. Note: Pass any additional a
  • timeAgoInWords() — Pass in a date to this method, and it will return a string describing the approximate time difference between that date
  • timeSelect() — Builds and returns a string containing three select form controls for hour, minute, and second based on the supplied obj
  • timeSelectTags() — Builds and returns a string containing three select form controls for hour, minute, and second based on name.
  • timeUntilInWords() — Pass in a date to this method, and it will return a string describing the approximate time difference between the curren
  • titleize() — Capitalizes all words in the text to create a nicer looking title.
  • toggle() — Assigns to the property specified the opposite of the property’s current boolean value. Throws an error if the property
  • toXHTML() — Returns an XHTML-compliant string.
  • truncate() — Truncates text to the specified length and replaces the last characters with the specified truncate string (which defaul
  • update() — Updates the object with the supplied properties and saves it to the database. Returns true if the object was saved succe
  • updateAll() — Updates all properties for the records that match the where argument. Property names and values can be passed in either
  • updateByKey() — Finds the object with the supplied key and saves it (if validation permits it) with the supplied properties and/or named
  • updateOne() — Gets an object based on the arguments used and updates it with the supplied properties. Returns true if an object was fo
  • updateProperties() — Updates all the properties from the properties argument or other named arguments. If the object is invalid, the save wil
  • updateProperty() — Updates a single property and saves the record without going through the normal validation procedure. This is especially
  • urlFor() — Creates an internal URL based on supplied arguments.
  • usesLayout() — Used within a controller’s init() function to specify controller- or action-specific layouts.
  • valid() — Runs the validation on the object and returns true if it passes it. Wheels will run the validation process automatically
  • validate() — Registers method(s) that should be called to validate objects before they are saved.
  • validateOnCreate() — Registers method(s) that should be called to validate new objects before they are inserted.
  • validateOnUpdate() — Registers method(s) that should be called to validate existing objects before they are updated.
  • validatesConfirmationOf() — Validates that the value of the specified property also has an identical confirmation value. (This is common when having
  • validatesExclusionOf() — Validates that the value of the specified property does not exist in the supplied list.
  • validatesFormatOf() — Validates that the value of the specified property is formatted correctly by matching it against a regular expression us
  • validatesInclusionOf() — Validates that the value of the specified property exists in the supplied list.
  • validatesLengthOf() — Validates that the value of the specified property matches the length requirements supplied. Use the exactly, maximum, m
  • validatesNumericalityOf() — Validates that the value of the specified property is numeric.
  • validatesPresenceOf() — Validates that the specified property exists and that its value is not blank.
  • validatesUniquenessOf() — Validates that the value of the specified property is unique in the database table. Useful for ensuring that two users c
  • validationTypeForProperty() — Returns the validation type for the property
  • verificationChain() — Returns an array of all the verifications set on this controller in the order in which they will be executed.
  • verifies() — Instructs CFWheels to verify that some specific criterias are met before running an action. Note that all undeclared arg
  • wordTruncate() — Truncates text to the specified length of words and replaces the remaining characters with the specified truncate string
  • yearSelectTag() — Builds and returns a string containing a select form control for a range of years based on the supplied name.