remove codeigniter
This commit is contained in:
+15
-15
@@ -56,7 +56,7 @@ class TeacherClass extends BaseModel
|
||||
|
||||
public function classSection(): BelongsTo
|
||||
{
|
||||
// CI frequently joins on classSection.class_section_id
|
||||
// legacy frequently joins on classSection.class_section_id
|
||||
return $this->belongsTo(ClassSection::class, 'class_section_id', 'class_section_id');
|
||||
}
|
||||
|
||||
@@ -95,18 +95,18 @@ class TeacherClass extends BaseModel
|
||||
}
|
||||
|
||||
/* ============================================================
|
||||
* CI-compatible methods (converted)
|
||||
* legacy-compatible methods (converted)
|
||||
* ============================================================
|
||||
*/
|
||||
|
||||
/** CI: getClassSectionIdByUserId() */
|
||||
/** legacy: getClassSectionIdByUserId() */
|
||||
public static function getClassSectionIdByUserId(int $userId): ?self
|
||||
{
|
||||
return static::query()->forTeacher($userId)->first();
|
||||
}
|
||||
|
||||
/**
|
||||
* CI: getClassAssignmentsByUserId()
|
||||
* legacy: getClassAssignmentsByUserId()
|
||||
* Returns array rows with:
|
||||
* class_section_pk, class_section_id, class_section_name, class_id, class_name, teacher_id, teacher_role, school_year, semester
|
||||
*/
|
||||
@@ -171,7 +171,7 @@ class TeacherClass extends BaseModel
|
||||
->all();
|
||||
}
|
||||
|
||||
/** CI: getClassSectionsByTeacherId() */
|
||||
/** legacy: getClassSectionsByTeacherId() */
|
||||
public static function getClassSectionsByTeacherId(int $teacherId): array
|
||||
{
|
||||
$rows = DB::table('teacher_class as tc')
|
||||
@@ -194,7 +194,7 @@ class TeacherClass extends BaseModel
|
||||
];
|
||||
}
|
||||
|
||||
/** CI: getClassByTeacherId() */
|
||||
/** legacy: getClassByTeacherId() */
|
||||
public static function getClassByTeacherId(int $teacherId): array
|
||||
{
|
||||
return DB::table('teacher_class as tc')
|
||||
@@ -207,7 +207,7 @@ class TeacherClass extends BaseModel
|
||||
->all();
|
||||
}
|
||||
|
||||
/** CI: getTeacherIdByClassSection($classSectionName, $semester, $schoolYear) */
|
||||
/** legacy: getTeacherIdByClassSection($classSectionName, $semester, $schoolYear) */
|
||||
public static function getTeacherIdByClassSection(string $classSectionName, string $semester, string $schoolYear): ?int
|
||||
{
|
||||
$classSectionName = trim($classSectionName);
|
||||
@@ -232,12 +232,12 @@ class TeacherClass extends BaseModel
|
||||
return $teacherId ? (int) $teacherId : null;
|
||||
}
|
||||
|
||||
/** CI: getMainTeacherBySection($classSectionName, $semester, $schoolYear) */
|
||||
/** legacy: getMainTeacherBySection($classSectionName, $semester, $schoolYear) */
|
||||
public static function getMainTeacherBySection(string $classSectionName, string $semester, string $schoolYear): ?array
|
||||
{
|
||||
$row = DB::table('classSection as cs')
|
||||
->selectRaw('u.id AS teacher_id, u.firstname, u.lastname')
|
||||
// IMPORTANT: your CI code had tc.class_section_id = cs.id in one place (PK join),
|
||||
// IMPORTANT: your legacy code had tc.class_section_id = cs.id in one place (PK join),
|
||||
// but most of your code uses class_section_id code join.
|
||||
// Here we keep the "code join" for consistency:
|
||||
->join('teacher_class as tc', 'tc.class_section_id', '=', 'cs.class_section_id')
|
||||
@@ -251,7 +251,7 @@ class TeacherClass extends BaseModel
|
||||
}
|
||||
|
||||
/**
|
||||
* CI: assignTeacherToClass()
|
||||
* legacy: assignTeacherToClass()
|
||||
* Upsert by (teacher_id, class_section_id, school_year, position) and touch updated_at.
|
||||
*/
|
||||
public static function assignTeacherToClass(
|
||||
@@ -286,8 +286,8 @@ class TeacherClass extends BaseModel
|
||||
}
|
||||
|
||||
/**
|
||||
* CI: getAssignedClassSections()
|
||||
* NOTE: your CI joins classSection.id = teacher_class.class_section_id (PK join).
|
||||
* legacy: getAssignedClassSections()
|
||||
* NOTE: your legacy joins classSection.id = teacher_class.class_section_id (PK join).
|
||||
* If your teacher_class.class_section_id is actually a section CODE, change join to cs.class_section_id.
|
||||
*/
|
||||
public static function getAssignedClassSections(int $teacherId, string $schoolYear, string $semester): array
|
||||
@@ -304,7 +304,7 @@ class TeacherClass extends BaseModel
|
||||
}
|
||||
|
||||
/**
|
||||
* CI: assignedForSectionTerm()
|
||||
* legacy: assignedForSectionTerm()
|
||||
* Returns rows: class_section_id, teacher_id, position, firstname, lastname
|
||||
*
|
||||
* @param int|null $alsoSectionCode When teacher_class rows use the section PK while $sectionCode
|
||||
@@ -347,7 +347,7 @@ class TeacherClass extends BaseModel
|
||||
->all();
|
||||
}
|
||||
|
||||
/** CI: assignedMapForSectionTerm() */
|
||||
/** legacy: assignedMapForSectionTerm() */
|
||||
public static function assignedMapForSectionTerm(
|
||||
int $sectionCode,
|
||||
string $semester,
|
||||
@@ -363,7 +363,7 @@ class TeacherClass extends BaseModel
|
||||
}
|
||||
|
||||
/**
|
||||
* CI: assignedBySectionForTerm()
|
||||
* legacy: assignedBySectionForTerm()
|
||||
* Returns: [sectionCode] => [rows...]
|
||||
*/
|
||||
public static function assignedBySectionForTerm(string $semester, string $schoolYear, ?array $onlySectionCodes = null): array
|
||||
|
||||
Reference in New Issue
Block a user