Here is a zip, if you want to start from this post. Unzip it in an empty webroot.

Today, we will cover the CFWheels ORM a little more. Specifically the return differences between some built in ORM calls and the logic why, specify the SQL order by clause and other sql fine-tuning, and build update and delete functionality.

What you see here is two objects and one query. You may think this is odd since you are using the CFWheels built in ORM and you thought the ORM calls would return the same structure. I thought the same thing but when talking to Per Djurner, it made perfect sense.

Here is what he said:
"The convention is that when you are fetching a single record from the
database (using findOne, findByKey etc) you will get an object back.When you
are fetching multiple records you will get a query result set back.
The "returnAs" argument is a way to override this convention (and it will be
improved a little more before we release 1.0)."

"The reasoning behind the convention is that when you are asking the database
for multiple records it is likely that you intend to display them (rather
than edit/delete them).
In this case objects are overkill (and even more so because of the poor
performance of object creation in ColdFusion)."

Mike Henke (pronounced hang-kee) has worked in ColdFusion development and databases since 1999. I have lived in Washington, DC area. I moved back to Omaha. My main focus currently is learning AngularJS and Ruby on Rails. I am also really interested in learning more about making development easier and more productive.