Hi,
I use MG scaffolding with CF9 orm to add records to a 3-table db.
Tables: category,message,comment.
Relations:
Category->message is many-to-many;
message->comment is one-to-many;
comment->message is many-to-one.
I have set up scaffolding by including in the ModelGlue.xml this:
<scaffold object="category" event-type="mainLayout" />
<scaffold object="comment" event-type="mainLayout" />
<scaffold object="message" event-type="mainLayout" />
I have configured 3 cfc's to be persistent, with their properties
reflecting columns and relationships.
This is all that is needed for adding, deleting, viewing etc the table
records.
I can add categories,messages and comments using the MG generated
templates. Comments I add get associated with their assigned messages. Also
categories get added and messages get added. When adding a message I have
to indicate the associated category by checking a checkbox for te
categoryname in the message form. But after submitting that messages, it
gets added but it never get assigned with the category.
The linktable stays empty,
When poking in the framework I saw in
/ModelGlue/gesture/modules/orm/cform/cfORMAdapter.cfc assemble()
where the submitted form is being parsed to create relationships that for
the many-to-many relation to exist an eventkey has to be persent that
doesn't exist:
assemble()
[...]
var eventKey = property.alias & "|" & property.sourceKey;
if (arguments.event.valueExists(eventKey)) {
[...]
translates in the case of submitting a messageform to
"categoryArray|categoryId"
so I need an event key "categoryArray|categoryId" with the id value of the
associated category.
In the form I have those 3 categories (the checkboxes) which named
Category Array|categoryId.
Since "categoryArray|categoryId" neq "Category Array|categoryId" I assume
this is the reason a many-to-many relationship is never working in this
case.
Am I off track here? Is this a bug and should it be filed?
Marc
--
Model-Glue Sites:
Home Page: http://www.model-glue.com
Documentation: http://docs.model-glue.com
Bug Tracker: http://bugs.model-glue.com
Blog: http://www.model-glue.com/blog
You received this message because you are subscribed to the Google
Groups "model-glue" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/model-glue?hl=en