public function Course::getTracker in Course 8.2
Same name and namespace in other branches
- 8.3 src/Entity/Course.php \Drupal\course\Entity\Course::getTracker()
- 3.x src/Entity/Course.php \Drupal\course\Entity\Course::getTracker()
Get the course tracker for this course/user.
Return value
1 call to Course::getTracker()
- Course::isEnrolled in src/
Entity/ Course.php - Check if a user is enrolled.
File
- src/
Entity/ Course.php, line 83
Class
- Course
- Defines the Course entity class.
Namespace
Drupal\course\EntityCode
public function getTracker(AccountInterface $account) {
$entities = \Drupal::entityTypeManager()
->getStorage('course_enrollment')
->loadByProperties([
'cid' => $this
->id(),
'uid' => $account
->id(),
]);
if ($entities) {
return reset($entities);
}
return FALSE;
}