Changeset 3270
- Timestamp:
- 11/29/07 10:09:54 (2 years ago)
- Files:
-
- 1 modified
-
trunk/tests/Ticket/438TestCase.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/Ticket/438TestCase.php
r3001 r3270 78 78 $this->newStudentCourse($student1, $course2); 79 79 80 // 1. Fetch relationship on demand 80 81 // 1. Fetch relationship on demand (multiple queries) 81 82 $q = new Doctrine_Query(); 82 83 $q->from('T438_StudentCourse sc') … … 94 95 $q->select('sc.*, s.*, c.*') 95 96 ->from('T438_StudentCourse sc, sc.Student s, sc.Course c') 96 ->where('sc.student_id = ? AND sc.course_id = ?',array('07090002', 'MATH001')); 97 ->where('sc.student_id = ? AND sc.course_id = ?',array('07090002', 'MATH001')) 98 ->execute(); 97 99 98 $record = $q-> execute()->getFirst();100 $record = $q->getFirst(); 99 101 $this->assertEqual($record->student_id, '07090002'); 100 102 $this->assertEqual($record->course_id, 'MATH001'); … … 118 120 public function setUp() 119 121 { 120 $this->hasMany('T438_Course as StudyCourses', array('refClass' => 'T438_StudentCourse', 'local' => 's c_student_id', 'foreign' => 'sc_course_id'));122 $this->hasMany('T438_Course as StudyCourses', array('refClass' => 'T438_StudentCourse', 'local' => 'student_id', 'foreign' => 'course_id')); 121 123 } 122 124 } … … 135 137 public function setUp() 136 138 { 137 $this->hasMany('T438_Student as Students', array('refClass' => 'T438_StudentCourse', 'local' => ' sc_course_id', 'foreign' => 'sc_student_id'));139 $this->hasMany('T438_Student as Students', array('refClass' => 'T438_StudentCourse', 'local' => 'course_id', 'foreign' => 'student_id')); 138 140 } 139 141 } 140 141 142 142 143 143 class T438_StudentCourse extends Doctrine_Record … … 149 149 $this->hasColumn('sc_student_id as student_id', 'varchar', 30, array ( 'primary' => true,)); 150 150 $this->hasColumn('sc_course_id as course_id', 'varchar', 20, array ( 'primary' => true,)); 151 $this->hasColumn('sc_remark as remark', 'varchar', 500, array ());151 $this->hasColumn('sc_remark as remark', 'varchar', 500, array ()); 152 152 } 153 153 154 154 public function setUp() 155 155 { 156 $this-> ownsOne('T438_Student as Student', array('local' => 'sc_student_id', 'foreign' => 's_id'));157 $this-> ownsOne('T438_Course as Course', array('local' => 'sc_course_id', 'foreign' => 'c_id'));156 $this->hasOne('T438_Student as Student', array('local' => 'student_id', 'foreign' => 'id')); 157 $this->hasOne('T438_Course as Course', array('local' => 'course_id', 'foreign' => 'id')); 158 158 } 159 159 }