0
に参加cfwheels多くの関係に多く、ここでインナーiがcfwheels(N:Mのrelationsship)での問題のカップルを持っている
私のデータベーススキーマ
rights righthaspath path
-id -------| -id --> -id
-role -->-rightid (FK) | -url
-pathid (FK)------|
私のモデル /Models/Right.cfc
<cffunction name="init">
<cfset hasMany(name="righthaspath",shortcut="path")>
<cfset nestedProperties(associations="righthaspath")>
</cffunction>
/Models/Path.cfc
<cffunction name="init">
<cfset hasMany(name="righthaspath")>
</cffunction>
SELECT rights.id,rights.Role,righthaspaths.id AS righthaspathid,righthaspaths.pathID,righthaspaths.rightID FROM rights
LEFT OUTER JOIN righthaspaths ON rights.id = righthaspaths.rightID
しかし、私は3以上のSQLステートメントをしたい:
/Models/Righthaspath.cfc
<cfset tmp= model("right").findall(include="righthaspath")>
ので、私のコントローラで
<cffunction name="init">
<cfset belongsTo("path")>
<cfset belongsTo("right")>
</cffunction>
、cfhweelsからのSQLステートメントがありますこのようなテーブル
SELECT
*
FROM
rights
INNER JOIN righthaspaths on rights.id=righthaspaths.rightID
INNER JOIN paths on righthaspaths.pathID=paths.id
お手伝いできますか?
PS:パスが含まれていません。
<cfset tmp= model("right").findall(include="righthaspath,path")>
私は上記のハンスMaeierを代表して、エラー
An association named path could not be found on the right model.
include = "righthaspath(path)"は正常に動作します –
答えとして回答を投稿して読者には分かりやすくしたいですか? –