ich ein paar Probleme mit cfwheels haben (n: m relationsship)viele zu viele Beziehung cfwheels Exklusionsverknüpfung
hier meine Datenbankschema
rights righthaspath path
-id -------| -id --> -id
-role -->-rightid (FK) | -url
-pathid (FK)------|
meine Modelle /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>
/Models/Righthaspath.cfc
<cffunction name="init">
<cfset belongsTo("path")>
<cfset belongsTo("right")>
</cffunction>
in meinem Controller-
<cfset tmp= model("right").findall(include="righthaspath")>
so ist die SQL-Anweisung von cfhweels:
SELECT rights.id,rights.Role,righthaspaths.id AS righthaspathid,righthaspaths.pathID,righthaspaths.rightID FROM rights
LEFT OUTER JOIN righthaspaths ON rights.id = righthaspaths.rightID
, aber ich möchte eine SQL-Anweisung über die drei Tabellen wie diese
SELECT
*
FROM
rights
INNER JOIN righthaspaths on rights.id=righthaspaths.rightID
INNER JOIN paths on righthaspaths.pathID=paths.id
können Sie helfen?
PS: Ich kann Pfad nicht einschließen, z.
<cfset tmp= model("right").findall(include="righthaspath,path")>
, weil ich einen Fehler bekam
An association named path could not be found on the right model.
include = "righthaspath (Pfad)" funktioniert –
Möchten Sie Ihre Antwort als Antwort posten, so dass es für die Leser klarer ist? –