public function Course::getObjects in Course 8.3
Same name and namespace in other branches
- 8.2 src/Entity/Course.php \Drupal\course\Entity\Course::getObjects()
- 3.x src/Entity/Course.php \Drupal\course\Entity\Course::getObjects()
Get the course objects in this course.
Return value
CourseObject[] An array of course objects.
1 call to Course::getObjects()
- Course::setActive in src/
Entity/ Course.php - Set the active CourseObject in this Course.
File
- src/
Entity/ Course.php, line 218
Class
- Course
- Defines the Course entity class.
Namespace
Drupal\course\EntityCode
public function getObjects() {
if (empty($this->courseObjects)) {
$efq = \Drupal::entityQuery('course_object');
$result = $efq
->condition('cid', $this
->id())
->sort('weight')
->execute();
if (!empty($result)) {
$this->courseObjects = \Drupal::entityTypeManager()
->getStorage('course_object')
->loadMultiple($result);
}
}
return $this->courseObjects;
}