У меня есть несколько проблем с cfwheels (п: м relationsship)отношения многие ко многим cfwheels внутреннее соединение
здесь мой схемы базы данных
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>
/Models/Righthaspath.cfc
<cffunction name="init">
<cfset belongsTo("path")>
<cfset belongsTo("right")>
</cffunction>
в моем контроллере
<cfset tmp= model("right").findall(include="righthaspath")>
так, то SQL заявление 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
, но я хочу SQL заявление в течение трех таблицы, подобные этому
SELECT
*
FROM
rights
INNER JOIN righthaspaths on rights.id=righthaspaths.rightID
INNER JOIN paths on righthaspaths.pathID=paths.id
может помочь?
PS: i can not include path eg.g.
<cfset tmp= model("right").findall(include="righthaspath,path")>
, потому что я получил ошибку
An association named path could not be found on the right model.
include = "righthaspath (path)" будет работать –
Хотите отправить ответ в качестве ответа, чтобы читателю было понятнее? –