public function OpignoActivity::getModules in Opigno module 3.x
Same name and namespace in other branches
- 8 src/Entity/OpignoActivity.php \Drupal\opigno_module\Entity\OpignoActivity::getModules()
Get list of activity modules.
Return value
array
File
- src/
Entity/ OpignoActivity.php, line 211
Class
- OpignoActivity
- Defines the Activity entity.
Namespace
Drupal\opigno_module\EntityCode
public function getModules() {
/* @var $db_connection \Drupal\Core\Database\Connection */
$db_connection = \Drupal::service('database');
$query = $db_connection
->select('opigno_module_relationship', 'om');
$query
->fields('om', [
'omr_id',
]);
$query
->condition('om.child_id', $this
->id());
$results = $query
->execute()
->fetchAll();
$om_ids = [];
foreach ($results as $result) {
$om_ids[] = $result->omr_id;
}
$module_storage = static::entityTypeManager()
->getStorage('opigno_module');
$modules = $module_storage
->loadMultiple($om_ids);
return $modules;
}