function testChangingParentIdRelationFieldDirectlyDoesNotWorkIfParentObjectIsDirty() { $course1 = $this->_initCourse(); $course1->save(); $course2 = $this->_initCourse(); $course2->save(); $lecture = new LectureForTest(); $lecture->setTitle('Physics'); $lecture->setCourse($course1); $lecture->save(); $lecture2 = new LectureForTest($lecture->getId()); $this->assertEqual($lecture2->getCourse()->getId(), $course1->getId()); $lecture2->set('course_id', $course2->getId()); $lecture2->setCourse($course1); $lecture2->save(); $lecture3 = new LectureForTest($lecture->getId()); $this->assertEqual($lecture3->getCourse()->getId(), $course1->getId()); }