Comments (6)
Reported by @blastiko on issue #1216. Most important was his discovery when using a where statement:
Update
This NOT work:
moduleclassroom=model("moduleclassroom").findByKey(select="teachers.firstname,secondteachers.firstname", key=params.key, include="teacher,secondteacher");
This NOT work:
moduleclassroom=model("moduleclassroom").findByKey(select="teachers.firstname,secondteachers.firstname AS secondteachers_firstname", key=params.key, include="teacher,secondteacher");
This NOT work:
moduleclassroom=model("moduleclassroom").findAll(select="teachers.firstname,secondteachers.firstname", where="moduleclassrooms.id = #params.key#", include="teacher,secondteacher");
This WORK:
moduleclassroom=model("moduleclassroom").findAll(select="teachers.firstname,secondteachers.firstname AS secondteachers_firstname", where="moduleclassrooms.id = #params.key#", include="teacher,secondteacher");
from cfwheels.
There appears to be an overwriting of table "teacher" data relative to the "secondteacher" data.
Perhaps is a alias building error?
Coused by wrong use (or not present) of AS clause in the query?
from cfwheels.
We made need an "alias" parameter on belongTo if the user wishes to join a table twice. This is a little more of @blastiko 's troubleshooting. I believe our auto-adding the table name to the select statement may be causing the issues.
@dbelanger: What happens if
-
you only include the secondTeacher and
-
you reverse the include order (ie. include= "secondTeacher, teacher")
@blastiko: With modelName="teachers" in module cfc
I get this error: "Error Executing Database Query. --Unknown column 'teachers.id' in 'field list'"
I get this error: "Executing Database Query. --Unknown column 'teachers.deletedat' in 'on clause'"
With modelName="teacher" in module cfc
I get this error: "Error Executing Database Query. --Unknown column 'teachers.firstname' in 'field list'"
I get this error: "Error Executing Database Query. --Unknown column 'teachers.deletedat' in 'on clause'"
If i use "teacher,secondteacher" i get no error but same initial problem
I've got those errors indipendently if i use modelName="teachers" or modelName="teacher", but only if i use include="secondtheacher,teacher". If i use include="teacher,secondtheacher" i get no errors, only wrong data for secondteacher.
from cfwheels.
I've definitely run into similar issues over the years and ended up just writing SQL. Glad this is being reviewed! Thanks for all the hard work.
from cfwheels.
I was trying a similar model and i noticed, that the both tables are used in the query like ...
FROM table
LEFT OUTER JOIN tablejoin ON table.first_key = tablejoin.primarykey
LEFT OUTER JOIN tablejoin AS tablejoin_ies ON table.second_key = tablejoin_ies.primarykey
So, there is a attached _ies
in the join and I cannot find this in the wheels repository or somewhere else. Where in the code is this attached?
from cfwheels.
FYI: There is a function $singularizeOrPluralize()
in wheels/global/internal.cfm
, at line 1080 ff.
from cfwheels.
Related Issues (20)
- buttonTo() does not accept "id" or "class" attributes HOT 2
- Monthly issue/pull request metrics report
- Enhacement for adding spacial datatypes
- Monthly issue/pull request metrics report
- Proposed Directory Structure Changes in CFWheels 3.0 HOT 1
- joinKey attribute doesn't appear to work for hasMany() HOT 2
- Rogue debug in db migration output
- CFWheels Docs bad link HOT 1
- Monthly issue/pull request metrics report
- Create core and template directories in build and move readme.md, server.json, and box.json files into it.
- Update build process to work with new directory structure
- JavaCast("int", local.rv) casts non-integers HOT 1
- Monthly issue/pull request metrics report
- The dataSource method appears to be broken
- findAll() method does not recognize aliased column names in the "where" attribute for tables joined in an association but has the same table column name HOT 1
- Monthly issue/pull request metrics report
- No documentation on using multiple attribute for select() form helper
- Monthly issue/pull request metrics report
- Onsessionend causing java heap space exhaustion and server hang
- Remove obfuscateParam function from migration CFC
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cfwheels.