I have a model (let's called it Sessions) that hasAndBelongsToMany Tags.
Each Session belongsTo a Track
Each Track belongsTo an Event
Each Event belongs to an EventGroup
A User may manage several EventGroups.
For UX purposes, I have condensed the maintenance of all these into one form. In short, the form allows the user to declare a new EventGroup, add one or more Events to it, and add one or more Tracks to each Event, and finally, set up all the Sessions for each Track. Each Session includes many fields for the User to define, including a few hasAndBelongsToMany multi-select boxes, like Tags (keywords).
CakePHP has allowed me to manage almost all of this on a single form, with the use of indices within loops like this:
echo $this->Form->input("EventGroup.0.Event.$event_index.Track.$track_index.Session.$session_index.id")
Then I use Javascript to manage the adding of new records and fields to the form (and Ajax to instatly delete records).
It works. Except the hasAndBelongsToMany Tags for the Sessions:
echo $this->Form->input("EventGroup.0.Event.$event_index.Track.$track_index.Session.$session_index.Tag")
This doesn't work. It neither automatically populates as a multi-select field (I have to force it manualy by setting 'multiple'=>true and 'options'=>$tags; nor does it automatically populate with existing SessionTags relationships defined in the database; nor will it save any such relationships set by the user in the UI.
Am I expecting too much or am I missing something? Is there a limit to the depth of relationships you can traverse and still have automagic work?
I'm really loathe to managing this manually and worried it will mess up the security hash for my form if I do.
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
No comments:
Post a Comment