Associations Chapter in Documentation
December 07, 2009
Posted in Community
Posted By: Chris Peters
A big part of Wheels's included <abbr title="Object Relational Mapping">ORM</abbr> is its use of <em>associations</em> to describe relationships between models. It's been a long time coming, but we released a <a title="Associations" href="https://cfwheels.org/docs/chapter/associations">chapter in the Docs about associations</a> along with the 0.9.1 release of ColdFusion on Wheels.
<!--more-->
Associations allow you to join data together in dynamic ways without needing to write any <abbr title="Structured Query Language">SQL</abbr>.
For example, once you define in your models that a user "has many" group memberships, you can make calls like this to obtain a query object containing the user's group memberships:
<div><cfset user = model("user").findByKey(params.key)>
<cfset memberships = user.groupMemberships()></div>
This is a very small taste of what associations can do for you. Be sure to <a title="Associations" href="https://cfwheels.org/docs/chapter/associations">read the chapter</a> to learn all about setting up associations and what's possible.
Please login to join the conversation! Login