I'm converting to Coldfusion's ORM and was wondering how do I replicate cfoutput's grouping using ORM?
I'm getting the following error : Can't cast Object type [java.util.ArrayList] to a value of type [query]
Query:
qryGames = ormExecuteQuery("from Game where Season.seasonID=:sid and League.leagueID=:lid and Season.User.userID=:uid order by League.leagueName, GameType.gameTypeID, gameDate DESC", {sid=url.sid, lid=leagueID, uid=session.userID});
Code:
<cfif arraylen(qryGames) GT 0>
<cfoutput query="qryGames" group="leagueName">
<cfoutput group="gameTypeName">
...
</cfoutput>
</cfoutput>
</cfif>
I don't see grouping attributes for cfloop. I could always manually replicate this but was wondering if there was a built in way to do it.
Update #1
Using entityToQuery
:
qryGames = entityToQuery(ormExecuteQuery("from Game where Season.seasonID=:sid and League.leagueID=:lid and Season.User.userID=:uid order by League.leagueName, GameType.gameTypeID, gameDate DESC", {sid=url.sid, lid=leagueID, uid=session.userID}), "League");
I get the following error:
Message column [gameTypeName] not found in query, columns are [leagueID,leagueName,leagueAbbr,teamName,gameInMinutes,deleteYN,showReportYN]
Limited to one entity name?
Use EntityToQuery()
http://cfdocs.org/entitytoquery first, then you can use <cfoutput query=