You are here

public static function CourseObjectAttendance::findObjectByCode in Course 3.x

Find an attendance course object by the attendance code.

Parameters

string $code: The SMS code.

Return value

CourseObject

2 calls to CourseObjectAttendance::findObjectByCode()
CourseObjectAttendance::generateWord in modules/course_attendance/src/Plugin/course/CourseObject/CourseObjectAttendance.php
Generate an attendance code that isn't used.
CourseObjectAttendance::optionsValidate in modules/course_attendance/src/Plugin/course/CourseObject/CourseObjectAttendance.php
Check code uniqueness.

File

modules/course_attendance/src/Plugin/course/CourseObject/CourseObjectAttendance.php, line 146

Class

CourseObjectAttendance
Plugin annotation @CourseObject( id = "attendance", label = "Attendance", )

Namespace

Drupal\course_attendance\Plugin\course\CourseObject

Code

public static function findObjectByCode(string $code) {
  $entities = Drupal::entityTypeManager()
    ->getStorage('course_object')
    ->loadByProperties([
    'object_type' => 'attendance',
    'instance' => $code,
  ]);
  return $entities ? reset($entities) : NULL;
}