Changeset 4498

Show
Ignore:
Timestamp:
06/08/08 21:05:02 (13 months ago)
Author:
guilhermeblanco
Message:

Fixes #1113. You have a problem with your model. M:N relations should never map both sides with hasOne.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/0.11/tests/Ticket/1113TestCase.php

    r4479 r4498  
    5353            $this->fail($e->getMessage()); 
    5454        } 
     55 
    5556        $reopend = Doctrine::getTable('VIH_Model_Course_Registration')->findOneById($registrar->id); 
     57 
    5658        try { 
    5759            $reopend->Subjects[] = $subject1; 
     
    140142                                                          'foreign' => 'id')); 
    141143 
    142         $this->hasOne('VIH_Model_Subject as Subjects', array('refClass' => 'VIH_Model_Course_Registration_Subject', 
     144        $this->hasMany('VIH_Model_Subject as Subjects', array('refClass' => 'VIH_Model_Course_Registration_Subject', 
    143145                                                             'local'    => 'registration_id', 
    144146                                                             'foreign'  => 'subject_id')); 
     
    176178        $this->hasColumn('subject_id', 'integer', null, array('primary' => true)); 
    177179    } 
    178  
    179     public function setUp() 
    180     { 
    181         $this->hasOne('VIH_Model_Course_SubjectGroup as SubjectGroup', array('local'   => 'subject_group_id', 
    182                                                                              'foreign' => 'id')); 
    183  
    184         $this->hasOne('VIH_Model_Subject as Subject', array('local'   => 'subject_id', 
    185                                                             'foreign' => 'id')); 
    186     } 
    187180} 
    188181