original_string: protected function migrateEnrollment($enrollment)
      {
          $user = $this->migratePerson($enrollment->person);
          try {
              $enrollment = ScoolEnrollment::firstOrNew([
                  'user_id'      => $user->id,
                  'study_id'     => $this->translateStudyId($enrollment->study_id),
                  'course_id'    => $this->translateCourseId($enrollment->course_id),
                  'classroom_id' => $this->translateClassroomId($enrollment->group_id)
              ]);
              $enrollment->state='Validated';
              $enrollment->save();
              return $enrollment;
          } catch (\Exception $e) {
              $this->output->error(
                  'Error migrating enrollment. ' . class_basename($e) . ' ' .  $e->getMessage());
              return null;
          }
      }
code: protected function migrateEnrollment($enrollment)
      {
          $user = $this->migratePerson($enrollment->person);
          try {
              $enrollment = ScoolEnrollment::firstOrNew([
                  'user_id'      => $user->id,
                  'study_id'     => $this->translateStudyId($enrollment->study_id),
                  'course_id'    => $this->translateCourseId($enrollment->course_id),
                  'classroom_id' => $this->translateClassroomId($enrollment->group_id)
              ]);
              $enrollment->state='Validated';
              $enrollment->save();
              return $enrollment;
          } catch (\Exception $e) {
              $this->output->error(
                  'Error migrating enrollment. ' . class_basename($e) . ' ' .  $e->getMessage());
              return null;
          }
      }
code_tokens: protected function migrateEnrollment ( $ enrollment ) { $ user = $ this -> migratePerson ( $ enrollment -> person ) ; try { $ enrollment = ScoolEnrollment :: firstOrNew ( [ 'user_id' => $ user -> id , 'study_id' => $ this -> translateStudyId ( $ enrollment -> study_id ) , 'course_id' => $ this -> translateCourseId ( $ enrollment -> course_id ) , 'classroom_id' => $ this -> translateClassroomId ( $ enrollment -> group_id ) ] ) ; $ enrollment -> state = 'Validated' ; $ enrollment -> save ( ) ; return $ enrollment ; } catch ( \ Exception $ e ) { $ this -> output -> error ( 'Error migrating enrollment. ' . class_basename ( $ e ) . ' ' . $ e -> getMessage ( ) ) ; return null ; } }
docstring: Migrate ebre-escool enrollment to scool enrollment.
  
  @param $enrollment
  @return null
docstring_tokens: Migrate ebre - escool enrollment to scool enrollment .