Because I am working on a legacy app with CFWheels, and that application had interfaces to the database outside of the CF application, database views became an important place to put some business logic, so it was available to all interfaces.
So, in order to be able to use CFWheels in some of the ways it was meant to, I need to be able to make a view be the source for models. Per, the keeper of CFW, pointed out that since views would not have primary keys, the CFW code would likely fail. And indeed, trying to access a model with the table property set to the name of a view caused the "No Primary Key" error, which insisted I set the primary keys for the table.
I found the line in the wheels code where this is checked, and temporarily (or perhaps longer) commented it out (model/initialization.cfm line 82-83).
This allowed me to call the model using cfset x = model("mymodel").mymethod. At least, it didn't error out. Within the method, I have a call to a cfquery, to match some legacy code. This all worked.
Next, I wanted to see if I could use the finders CFWheels gives us.
Unfortunately, I get an "Element I.VALUE is undefined in LOC" error coming from the SQLServer adapter. I will be looking into this
Subscribe to:
Post Comments (Atom)
Maybe you should submit a ticket? http://bit.ly/1xveYZ
ReplyDeleteHey Mike, I want to do a bit more research, to understand what causes the issue, then will post a ticket. I agree with you that it is likely a flag will need to be added to the init function to turn off the need for a primary key, but perhaps more also.
ReplyDelete