Ticket #226: aliasBugs.txt

File aliasBugs.txt, 3.9 kB (added by Bryan S, 19 years ago)

The text of the ticket

Line 
1I 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
3I 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
5I 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
7If there is something you need to know to help me please ask. Thanks.
8
9
10The first problem was fixed by changing this in
11D:\Inetpub\wwwroot\ModelGlue\unity\controller\ReactorORMController.cfc
12line 195
13
14was
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
20is 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
31I also ran into these problems in the xsl files
32
33edit.xsl
34
35had to change select="name"/> to select="alias"/>
36    <xsl:if test="relationship = 'false'">
37        &lt;div class="formfield"&gt;
38                &lt;label for="<xsl:value-of select="name"/>" &lt;cfif structKeyExists(validation, &quot;<xsl:value-of select="alias"/>&quot;)>class=&quot;error&quot;&lt;/cfif&gt;&gt;&lt;b&gt;<xsl:value-of select="label"/>:&lt;/b&gt;&lt;/label&gt;
39
40had to comment out because it wasn't a valid query
41                  &lt;cfif viewstate.exists("<xsl:value-of select="alias"/>|<xsl:value-of select="sourcekey"/>")&gt;
42            &lt;cfset selectedList = viewstate.getValue("<xsl:value-of select="alias"/>|<xsl:value-of select="sourcekey"/>") /&gt;
43          &lt;cfelse&gt;
44            &lt;cfset selectedList = valueList(selectedQuery.<xsl:value-of select="sourcekey"/>) /&gt;
45          &lt;/cfif&gt;
46 
47 had to comment out because the query didn't exist because of above         
48      &lt;input type="hidden" name="<xsl:value-of select="alias"/>|<xsl:value-of select="sourcekey"/>" value="" /&gt;
49                &lt;div class="formfieldinputstack"&gt;
50          &lt;cfoutput query="valueQuery"&gt;
51            &lt;label for="<xsl:value-of select="alias"/>_#valueQuery.<xsl:value-of select="sourcekey"/>#"&gt;&lt;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"/>#"&lt;cfif listFindNoCase(selectedList, "#valueQuery.<xsl:value-of select="sourcekey"/>#")&gt; checked&lt;/cfif&gt;/&gt;#valueQuery.<xsl:value-of select="sourcecolumn"/>#&lt;/label&gt;&lt;br /&gt;
52          &lt;/cfoutput&gt;
53                &lt;/div&gt;
54