| 1 | I am running into one problem after another working with scaffolding, a table structure with one to many relationships and aliased columns. Everything works great if I use the original database object name but if I use the aliased column names I fix one bug only to be stopped by another. Since I don't have a full grasp of the design of Model Glue I'm getting to the point where I believe my fixes are hacks and describing them all will be counter productive. I think it will be easier for whomever to reproduce them. A picture is worth a thousand words kind of thing. |
|---|
| 2 | |
|---|
| 3 | I have attached files that will allow you to easily create my simple schema and the reactor.xml and ModelGlue.xml that works for the object names but not the alias names. |
|---|
| 4 | |
|---|
| 5 | I made it through a number of issues in reactor (which it appears were due to my inexperience) and now I've come out in Model Glue and I ran into a problem where the object name was being used to call getPRE_COLUMN_NAME() instead of using the alias name to call getColumnName(). I fixed that by doing what is below but now I ran into a problem where setPRE_COLUMN_NAME is being called instead of setColumnName at line 377 of D:\Inetpub\wwwroot\ModelGlue\unity\orm\ReactorAdapter.cfc |
|---|
| 6 | |
|---|
| 7 | If there is something you need to know to help me please ask. Thanks. |
|---|
| 8 | |
|---|
| 9 | |
|---|
| 10 | The first problem was fixed by changing this in |
|---|
| 11 | D:\Inetpub\wwwroot\ModelGlue\unity\controller\ReactorORMController.cfc |
|---|
| 12 | line 195 |
|---|
| 13 | |
|---|
| 14 | was |
|---|
| 15 | <cfloop from="1" to="#arrayLen(metadata.primaryKeys)#" index="i"> |
|---|
| 16 | <cfinvoke component="#record#" method="get#metadata.primaryKeys[i]#" returnvariable="tmp" /> |
|---|
| 17 | <cfset arguments.event.setValue(metadata.primaryKeys[i], tmp) /> |
|---|
| 18 | </cfloop> |
|---|
| 19 | |
|---|
| 20 | is now |
|---|
| 21 | |
|---|
| 22 | <cfloop collection="#metadata.properties#" item="j" > |
|---|
| 23 | <cfif metadata.primaryKeys[i] EQ metadata.properties[j].name> |
|---|
| 24 | <cfinvoke component="#record#" method="get#metadata.properties[j].alias#" returnvariable="tmp" /> |
|---|
| 25 | </cfif> |
|---|
| 26 | </cfloop> |
|---|
| 27 | <cfset arguments.event.setValue(metadata.primaryKeys[i], tmp) /> |
|---|
| 28 | </cfloop> |
|---|
| 29 | |
|---|
| 30 | |
|---|
| 31 | I also ran into these problems in the xsl files |
|---|
| 32 | |
|---|
| 33 | edit.xsl |
|---|
| 34 | |
|---|
| 35 | had to change select="name"/> to select="alias"/> |
|---|
| 36 | <xsl:if test="relationship = 'false'"> |
|---|
| 37 | <div class="formfield"> |
|---|
| 38 | <label for="<xsl:value-of select="name"/>" <cfif structKeyExists(validation, "<xsl:value-of select="alias"/>")>class="error"</cfif>><b><xsl:value-of select="label"/>:</b></label> |
|---|
| 39 | |
|---|
| 40 | had to comment out because it wasn't a valid query |
|---|
| 41 | <cfif viewstate.exists("<xsl:value-of select="alias"/>|<xsl:value-of select="sourcekey"/>")> |
|---|
| 42 | <cfset selectedList = viewstate.getValue("<xsl:value-of select="alias"/>|<xsl:value-of select="sourcekey"/>") /> |
|---|
| 43 | <cfelse> |
|---|
| 44 | <cfset selectedList = valueList(selectedQuery.<xsl:value-of select="sourcekey"/>) /> |
|---|
| 45 | </cfif> |
|---|
| 46 | |
|---|
| 47 | had to comment out because the query didn't exist because of above |
|---|
| 48 | <input type="hidden" name="<xsl:value-of select="alias"/>|<xsl:value-of select="sourcekey"/>" value="" /> |
|---|
| 49 | <div class="formfieldinputstack"> |
|---|
| 50 | <cfoutput query="valueQuery"> |
|---|
| 51 | <label for="<xsl:value-of select="alias"/>_#valueQuery.<xsl:value-of select="sourcekey"/>#"><input type="checkbox" name="<xsl:value-of select="alias"/>|<xsl:value-of select="sourcekey"/>" id="<xsl:value-of select="alias"/>_#valueQuery.<xsl:value-of select="sourcekey"/>#" value="#valueQuery.<xsl:value-of select="sourcekey"/>#"<cfif listFindNoCase(selectedList, "#valueQuery.<xsl:value-of select="sourcekey"/>#")> checked</cfif>/>#valueQuery.<xsl:value-of select="sourcecolumn"/>#</label><br /> |
|---|
| 52 | </cfoutput> |
|---|
| 53 | </div> |
|---|
| 54 | |
|---|