ColdFusion on Wheels 0.7 released
April 23, 2008
CFWheels, the ColdFusion framework inspired by Ruby on Wheels has just reached version 0.7. I've just been reading the docs and really like some of the features it has. It is an MVC framework and as with all frameworks it has it's strengths and weaknesses and will not suit every project. The documentation is currently sparse (although more is planned) but you should definitely check it out.
Some examples of handling data are:
Reading records:
<cfset author = model("author").findById(params.id) />
In the above example params is the URL scope and author is the database table. This approach will be familiar to DAO users. What I like is that you can also do this:
<cfset bobsArticles = model("author").findAll(where="firstName='bob'", include="articles")>
In this example you can construct the where clause yourself and reference another table (obviously you'll need to set up the relationship between the author and articles tables).
The same approach applies to updating records
<cfset recordsReturned = model("post").updateAll(published=1, publishedAt=now(), where="published=0")>
Other features that CFWheels support are soft delete, time stamping & Pagination.
Find out more at:
www.cfwheels.com/docs/
- Posted in:
- ColdFusion
- ColdFusion on Wheels
2 comments
Leave a comment
If you found this post useful, interesting or just plain wrong, let me know - I like feedback :)





yea I was reading the docs yesterday, looking pretty good. I think I may use CFWheels for a small project...
Can't wait for them to finish the docs.
"(obviously you'll need to set up the relationship between the author and articles tables)"
How do you tell your ORM about table relationships?
Comment by sal – April 24, 2008
@sal: To set up relationships...
Let's say you have 2 tables, articles and comments, where the comments are for the articles. You would have a foreign key in comments called article_id.
In model/article.cfc's init() method, you would have a call to hasMany('articles'). In model/comment.cfc's init() method, you would have a call to belongsTo('article').
Hope that helps get you started!
Comment by Chris Peters – May 22, 2008