Ticket #113 (new defect)

Opened 2 years ago

Last modified 3 months ago

Field Name is used rather than Alias in Dictionary XML

Reported by: dshuck Owned by: dhughes
Type: defect Priority: normal
Milestone: 1.0 Release Component: Reactor - Validator
Version: Severity: major
Keywords: spam Cc:

Description

Example: I have a DB table named TERRIBLE_FOO_NAME, which I am aliasing as "Foo". When the Dictionary XML is generated, the Name is written instead of the Alias, thereby making keeping the Translated Errors from working properly.

<terrible_foo_name>

<label>TERRIBLE_FOO_NAME</label>
<comment/>
<maxlength>0</maxlength>
<notProvided>The TERRIBLE_FOO_NAME field is required but was not provided.</notProvided>
<invalidType>The TERRIBLE_FOO_NAME field does not contain valid data. This field must be a numeric value.</invalidType>

</terrible_foo_name>

Attachments

objectTranslator.cfc (14.2 kB) - added by dshuck 2 years ago.
my revised objectTranslator.cfc

Change History

Changed 2 years ago by dshuck

I sent the following to both Beth and Doug. I am reposting here just to make sure it doesn't get lost:
To the best of my admittedly limited view it seems that there are two feasible ways to accomplish this.

  1. Without touching any other components in the framework, I tested adding a getFieldAlias() method in the objectTranslator.cfc , which works quite nicely. If no alias is defined it returns the fieldname rather than an explicit alias. In addition to creating the method, there are 4 places that field.name becomes field.alias in the generateDictionary() method after setting field.alias = getFieldAlias(Object,field.name).
  1. The bigger more holistic approach would be add "alias" the the field structure that is created in the individual DBMS-specific DAOs. I didn't try it but it would be very simple to add the exact same method I put in the objectTraslator into the abstractDao instead. Then when the field structures are being built, alias is a key in that structure. To apply this to the Dictionary problem, there are 4 places that field.name would need to change to field.alias, as I have done in solution #1.

In the chance that you guys wish to use option one, I am attaching my objectTranslator.cfc

Changed 2 years ago by dshuck

my revised objectTranslator.cfc

Changed 3 months ago by mark.drew@…

  • milestone set to 1.0 Release

Changed 3 months ago by TomChiverton

  • keywords spam added
Note: See TracTickets for help on using tickets.