CHANDAN PATTNAIK
CHANDAN PATTNAIK

Reputation: 45

can a table have hasMany relation with multiple table

Will the given below code can work where Mark and Subject are two model with which Student model associate through hasMany association

class Student extends AppModel
{
    public $name = 'Student';
    var $hasMany = array(
        'Mark' => array(
            'className' => 'Mark',
            'foreignKey' => 'student_id'
        ),
        'Subject' => array(
            'className' => 'Subject',
            'foreignKey' => 'student_id'
        )
    );
}

Upvotes: 0

Views: 508

Answers (1)

Related Questions