I think this is an easy association question but Cake is not behaving
like I expect.

In my app, users complete a form called an Epp.  Included on the form
are a bunch of repititive input fields where the users key in text
about their current courses.

Example:
Question: List the courses you are enrolled in this term:
<course name> <credits> ...
<course name> <credits> ...
<course name> <credits> ...

Where each <course name> is a unique $html->input.

I'd like to have the course info stored in its own table rather than in
the same table as the rest of my form data.  Thus I can use a
one-to-many relationship to associate them.

Here's my SQL:

CREATE TABLE `courses` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `epp_id` int(10) NOT NULL default '0',
  `course_name` varchar(64) default NULL
  ...
  PRIMARY KEY  (`id`)
)

CREATE TABLE `epps` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `created` datetime default NULL,
  `modified` datetime default NULL,
  ...
  PRIMARY KEY  (`id`)
)

So let's say I have Epps with ids of 10 and 11.  The courses table
might contain:

1,10,'foo1'...
2,10,'bar1'...
3,11,'foo2'...
4,11,'bar2'...

Courses do not need to know about their Epps, but each Epp needs to be
able to save/get it's list of courses.

class Epp extends AppModel
{
    var $name = 'Epp';

        var $hasMany = array('course_association' =>
        array(
                'className' => 'Course',
                'conditions' => '',
                'order' => '',
                'dependent' => true,
                'foreignKey' => 'epp_id'
        )
    );

    var $recursive = 1;

        //var $hasMany = 'Course';
}

Is there any way to support this with hasMany?


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~----------~----~----~----~------~----~------~--~---

Reply via email to