public function CourseObjectFulfillment::save in Course 3.x
Same name and namespace in other branches
- 8.3 src/Entity/CourseObjectFulfillment.php \Drupal\course\Entity\CourseObjectFulfillment::save()
- 8.2 src/Entity/CourseObjectFulfillment.php \Drupal\course\Entity\CourseObjectFulfillment::save()
Track course after saving fulfillment.
Overrides EntityBase::save
File
- src/
Entity/ CourseObjectFulfillment.php, line 165
Class
- CourseObjectFulfillment
- Parent class for course object fulfillment. Unlike Course objects, this is not abstract and can be used when the fulfillment requirements are simple.
Namespace
Drupal\course\EntityCode
public function save() {
// Make sure the user is enrolled first.
if ($this
->getCourseObject()
->getCourse()
->getEnrollment($this
->getUser())) {
parent::save();
// Re-evaluate requirements.
$account = $this
->getUser();
$this
->getCourseObject()
->getCourse()
->getEnrollment($account)
->track();
return $this;
}
else {
return FALSE;
}
}