function cleanTables($connection)
 {
     $db = new lmbSimpleDb($connection);
     foreach ($this->affected_tables as $table) {
         $db->delete($table);
     }
 }
 function testProcessPrefixedFieldsAsRelatedActiveRecords()
 {
     $course = $this->_createCourseWithTwoLectures();
     $lecture = new LectureForTest();
     $course_info = $lecture->getRelationInfo('course');
     $conn = lmbToolkit::instance()->getDefaultDbConnection();
     $db = new lmbSimpleDb($conn);
     $sql = 'SELECT ' . $conn->quoteIdentifier("lecture_for_test") . '.*, ' . $conn->quoteIdentifier("course_for_test.id") . ' as ' . $conn->quoteIdentifier("course__id") . ', ' . $conn->quoteIdentifier("course_for_test.title") . ' as ' . $conn->quoteIdentifier("course__title") . ' 
         FROM ' . $conn->quoteIdentifier("lecture_for_test") . ' LEFT JOIN ' . $conn->quoteIdentifier("course_for_test") . ' ON ' . $conn->quoteIdentifier("course_for_test.id") . ' = ' . $conn->quoteIdentifier("lecture_for_test.course_id");
     $decorated = lmbDBAL::fetch($sql);
     $iterator = new lmbARRecordSetJoinDecorator($decorated, new LectureForTest(), null, array('course' => $course_info));
     // let's fetch all data in order to actually call rewind() and current();
     $arr = $iterator->getArray();
     // now let's remove everything from db tables so we can be sure that processing is correct
     $db->delete('lecture_for_test');
     $db->delete('course_for_test');
     $this->assertEqual($arr[0]->get('course')->getTitle(), $course->getTitle());
     $this->assertEqual($arr[1]->get('course')->getTitle(), $course->getTitle());
 }