fullName. If your database table has fields for
lastName, it wouldn't make sense to store a third column called
fullName. This would require more storage for redundant data, and it would add extra complexity that could lead to bugs and maintenance problems in the future.
getFullName(), which would return the concatenation of
this.firstName & " " & this.lastName. The
getFullName()method could potentially provide arguments to list the last name first and other types of calculations or transformations as well.
returnAs="objects"argument in methods like findAll(), but we advise against it when fetching large data sets because of the slowness of
CreateObject()across CFML engines.
SELECTclause to generate the `fullName.
agebased on the
birthDatecolumn, our calculated property in
config()may look something like this:
fullNameexample above, this will cause the database to add a property called
agestoring the user's age as an integer.
ageto return users who are in their 20s. We can use the new
ageproperty as if it existed in the database table. For extra measure, let's also sort the results from oldest to youngest.
charas the column data type. Whilst this covers most scenarios, if you want to return something like a date, it can be problematic. Thankfully we can just specify a
dataTypeargument to return the appropriate data type.