*/ public function getSubjectIdsForTeacher(int $teacherId): array { $rows = $this->select('subject_id') ->where('teacher_user_id', $teacherId) ->findAll(); return array_map(static fn ($row) => (int) $row['subject_id'], $rows); } /** * Get mapping: subject_id => [teacher_user_id, ...]. * * @return array> */ public function getMapSubjectToTeacherIds(): array { $rows = $this->select('teacher_user_id, subject_id')->findAll(); $map = []; foreach ($rows as $r) { $s = (int) $r['subject_id']; $t = (int) $r['teacher_user_id']; $map[$s][] = $t; } return $map; } }