author
object in the application
scope (unless it's the first time you call this function, in which case it will also create and store it in the application
scope).author
object, you can start calling class methods on it, like findByKey(), for example. findByKey()returns an instance of the object with data from the database record defined by the key value that you pass.author
is just an example here, and you'll use the names of the .cfc
files you have created in the models
folder.firstName
field of the author
record with a primary key value of 1
to Joe
.id
, it increments automatically, and it's of the integer
data type. However, CFWheels is very flexible in this area. You can setup your primary keys in practically any way you want to. You can use natural keys (varchar
, for example), composite keys (having multiple columns as primary keys), and you can name the key(s) whatever you want.models
folder and make it extend the Model.cfc
file.models
folder. That's where they'll go.authors
table. (For the purpose of showing some examples, we will assume that you have created a file named Author.cfc
, which will then be mapped to the authors
table in the database).1
, change his first name, and save the record back to the database.Author.cfc
class, the table name should be authors
.config()
method of your class file, which is where all configuration of your model is done.author
model to map to a table in your database named tbl_authors
, you would add the following code to the config()
method:session
scope, an external NoSQL database, or as an email sent from a contact form).this
scope.null
/ nil
in CFML (at least not in the earlier versions of it which we still support), CFWheels will assume that when you save a blank string to the database it should be converted to NULL
.NULL
values once they've been mapped to a CFWheels object / result set).