|
Hello All, So, Ive searched the archives of the reactor mailing list, for this problem. I've found something similar but it was never solved. Essentially Im trying to join multiple tables using MG:U/reactor (but not MG:U's native GDBM's). First off here is my reactor.xml: <reactor> <objects> <object name="users"> <hasOne name="userGroups"> <relate from="userGroup" to="id" /> </hasOne> </object> <object name="userGroups"> <hasMany name="permissions"> <link name="userGroupPermissions" /> </hasMany> </object> <object name="permissions"> <hasMany name="userGroups"> <link name="userGroupPermissions" /> </hasMany> </object> <object name="userGroupPermissions"> <hasOne name="userGroups"> <relate from="groupid" to="id" /> </hasOne> <hasOne name="permissions"> <relate from="permissionid" to="id" /> </hasOne> </object> </objects> </reactor> K so I've literally written the out the SQL and ran it successfully with CocoaMySQL, essentially Im trying to convert the following SQL: SELECT users.id, permissions.permissionName FROM users JOIN userGroupPermissions ON users.userGroup = userGroupPermissions.groupid JOIN permissions ON userGroupPermissions.permissionid = permissions.id WHERE users.id = 2; So my source code is as follows: <cfset var permissionList = StructNew() /> <cfset var reactor = getModelGlue().getORMService() /> <cfset var userGateway = reactor.createGateway("users") /> <cfset var q = userGateway.createQuery() /> <cfset q.getWhere().isEqual("users","id",#arguments.userId#) /> <cfset q.join("users","userGroupPermissions", "userGroupPermissions").join("userGroupPermissions","permissions","permissions") /> <cfset q.returnObjectField("users","id").return.ObjectField("permissions","permissionName") /> <cfset permissionList = userGateway.getByQuery(q) /> Keep in mind that the arguments.userId is the 2 that I tested externally... So the error Im getting is as follows: Oops!
So I guess my main questions are, does my reactor code syntactically look correct in comparison to the SQL query I want to perform, and Im not exactly sure what the third argument of the join method means (relationshipAlias)??? Can anyone share some knowledge on this situation with me?? Thanks Sal -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- Reactor for ColdFusion Mailing List [email protected] Archives at: http://www.mail-archive.com/reactor%40doughughes.net/ -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- |
- [Reactor for CF] relationship/join/syntax issue...? SAL VALVERDE
- Re: [Reactor for CF] relationship/join/syntax issue...... Denny Valliant
