Ticket #315 (closed defect: duplicate)

Opened 17 years ago

Last modified 16 years ago

Transfer Scaffolding inserts "wrong" ID name for related items

Reported by: stephenmoretti Owned by: boomfish
Priority: high Milestone: 3.1 Maintenance Beta
Version: 2.0.304 Severity: major
Keywords: TransferORM, Unity Cc:

Description

I was scaffolding a couple of simple crud applications and kept getting an error from the edit form for fields in a plural relationship. It seems that the view generator is inserting the wrong primary key field name.

Looking at it further, the object XML the sourceKey field for the related item was showing the column name, which is correct in most cases. However, we have some legacy components that require the ID field of a table to be "ID", where as I have "tablenameID". To compensate I used the alias property in the transfer package to set the primary key name to "ID".

Looking in the Transfer Adapter, when the sourceKey is set for a primary key it doesn't take into account if there is an alias and hence why I was getting an error.

Anyway, hope that makes sense. Attached is a patch, so that if a PK field has an alias the adapter uses the alias rather than the name.

Attachments

TransferAdapter.cfc.patch (0.6 kB) - added by stephenmoretti 17 years ago.
Patch file for Transfer Adapter to use alias for sourcekey value when available

Change History

Changed 17 years ago by stephenmoretti

Patch file for Transfer Adapter to use alias for sourcekey value when available

Changed 16 years ago by DanWilson

  • milestone set to 3.1.x-next-patch

I looked at the current transferAdapter and it does not have this snippet of code. I wonder if we fixed this another way? Adding this to the 3.1.next release for discussion.

Changed 16 years ago by boomfish

No, this is still an issue; I was bitten by it in MG2 and saw the issue was still there while working with Bob on the CF-ORM adapter for MG3. I suspect most people avoid the issue by forcing their entity property names to match the database column names.

I believe the issue appears in multiple places and another ticket contains a more complete patch. I'll see if I can find it.

Changed 16 years ago by DanWilson

issue 295? http://docs.model-glue.com/ticket/295

I believe you are right. Seems like an easy fix.

We just need a testharness to verify the fix since there aren't many unit tests covering this side of the fence. Do you have such a test harness or application you can use to verify the patch works?

DW

Changed 16 years ago by boomfish

  • owner changed from somebody to boomfish

Yes, that's the ticket and patch I remember. I can easily modify my Walidget application to use it to test any fixes for this issue.

FYI you can link to other tickets in comments by using the # sign like so: #295.

Changed 16 years ago by boomfish

  • status changed from new to assigned

Changed 16 years ago by boomfish

  • status changed from assigned to closed
  • resolution set to duplicate

Closing ticket as a duplicate of #295.

Note: See TracTickets for help on using tickets.