Ticket #226 (closed defect: worksforme)

Opened 19 years ago

Last modified 19 years ago

Alias Problems Consolidated

Reported by: Bryan S Owned by: somebody
Priority: highest Milestone: 2.0 Beta 2
Version: Severity: blocker
Keywords: Cc:

Description

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.

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.

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

If there is something you need to know to help me please ask. Thanks.

The first problem was fixed by changing this in D:\Inetpub\wwwroot\ModelGlue?\unity\controller\ReactorORMController.cfc line 195

was

<cfloop from="1" to="#arrayLen(metadata.primaryKeys)#" index="i">

<cfinvoke component="#record#" method="get#metadata.primaryKeys[i]#" returnvariable="tmp" /> <cfset arguments.event.setValue(metadata.primaryKeys[i], tmp) />

</cfloop>

is now

<cfloop collection="#metadata.properties#" item="j" >

<cfif metadata.primaryKeys[i] EQ metadata.properties[j].name>

<cfinvoke component="#record#" method="get#metadata.properties[j].alias#" returnvariable="tmp" />

</cfif>

</cfloop> <cfset arguments.event.setValue(metadata.primaryKeys[i], tmp) />

</cfloop>

I also ran into these problems in the xsl files

edit.xsl

had to change select="name"/> to select="alias"/>

<xsl:if test="relationship = 'false'">

&lt;div class="formfield"&gt;

&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;

had to comment out because it wasn't a valid query

&lt;cfif viewstate.exists("<xsl:value-of select="alias"/>|<xsl:value-of select="sourcekey"/>")&gt;

&lt;cfset selectedList = viewstate.getValue("<xsl:value-of select="alias"/>|<xsl:value-of select="sourcekey"/>") /&gt;

&lt;cfelse&gt;

&lt;cfset selectedList = valueList(selectedQuery.<xsl:value-of select="sourcekey"/>) /&gt;

&lt;/cfif&gt;

had to comment out because the query didn't exist because of above

&lt;input type="hidden" name="<xsl:value-of select="alias"/>|<xsl:value-of select="sourcekey"/>" value="" /&gt;

&lt;div class="formfieldinputstack"&gt;

&lt;cfoutput query="valueQuery"&gt;

&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;

&lt;/cfoutput&gt;

&lt;/div&gt;

Attachments

aliasBugs.txt (3.9 kB) - added by Bryan S 19 years ago.
The text of the ticket
aliasBugs.2.txt (3.9 kB) - added by Bryan S 19 years ago.
The text of the ticket
aliasBugsXml.txt (1.3 kB) - added by Bryan S 19 years ago.
The xml that works with objects but not aliases
aliasBugsSchemaMySQL.txt (5.5 kB) - added by Bryan S 19 years ago.
The sql to create my schema in MySql?
aliasBugsSchema.txt (4.9 kB) - added by Bryan S 19 years ago.
The schema to create my schema in Oracle
aliasBugsSchemaTriggers.txt (5.5 kB) - added by Bryan S 19 years ago.
The sql to create my primary key triggers in Oracle
ReactorObjectAlias.xml (6.1 kB) - added by Bryan S 19 years ago.
This is the xml that works for the object but not the alias

Change History

Changed 19 years ago by Bryan S

The text of the ticket

Changed 19 years ago by Bryan S

The text of the ticket

Changed 19 years ago by Bryan S

The xml that works with objects but not aliases

Changed 19 years ago by Bryan S

The sql to create my schema in MySql?

Changed 19 years ago by Bryan S

The schema to create my schema in Oracle

Changed 19 years ago by Bryan S

The sql to create my primary key triggers in Oracle

  Changed 19 years ago by Bryan S

Sorry about the duplicate file. I can't figure out how to delete it.

Changed 19 years ago by Bryan S

This is the xml that works for the object but not the alias

  Changed 19 years ago by joe.rinehart

I'll spool these tables in and find out what the issue is this week.

As an aside, thanks for being so thorough - this is the kind of ticket submission we normally only dream of!

follow-up: ↓ 4   Changed 19 years ago by joe.rinehart

  • milestone set to Release Public Beta 2

in reply to: ↑ 3   Changed 19 years ago by Bryan S

Replying to joe.rinehart:

I'm glad you found the attachments useful. I'm more than happy to help you help me.

I'm not sure that this is a bug. It may be asking more than can be delivered but I thought I'd mention it.

If you add an app to the APP_MAIN table and then you try to add a new APP_ROLE the app you just added will properly appear as a check box for association with the new role. However, if you select it when first adding the role you get an integrity constraint violation error. You need to save the new role first and then go back to the form and associate it with the app.

  Changed 19 years ago by joe.rinehart

  • status changed from new to closed
  • resolution set to worksforme

I've done a version of the Widget sample application (it'll be in SVN soon) where I aliased every column, table, and property to something outlandishly different, and it worked fine - I recommend doing things outside of MG:U to make sure your alias scheme is correct.

Note: See TracTickets for help on using tickets.