function opigno_group_manager_update_8008 in Opigno group manager 8
Remove deleted ILT and Live meetings from opigno_group_content.
File
- ./
opigno_group_manager.install, line 124 - Opigno group manager install/update functionality.
Code
function opigno_group_manager_update_8008() {
// Remove ILTs.
$query = \Drupal::database()
->select('opigno_group_content', 'g')
->fields('g', [
'id',
]);
$query
->leftJoin('opigno_ilt', 'i', 'g.entity_id = i.id');
$query
->where('g.group_content_type_id = :condition', [
':condition' => 'ContentTypeILT',
]);
$query
->isNull('i.id');
$ids = $query
->execute()
->fetchCol();
/* @var \Drupal\opigno_group_manager\Entity\OpignoGroupManagedContent[] $opigno_group_managed_contents */
$opigno_group_managed_contents = OpignoGroupManagedContent::loadMultiple($ids);
foreach ($opigno_group_managed_contents as $opigno_group_managed_content) {
$opigno_group_managed_content
->delete();
}
// Remove Live meetings.
$query = \Drupal::database()
->select('opigno_group_content', 'g')
->fields('g', [
'id',
]);
$query
->leftJoin('opigno_moxtra_meeting', 'i', 'g.entity_id = i.id');
$query
->where('g.group_content_type_id = :condition', [
':condition' => 'ContentTypeMeeting',
]);
$query
->isNull('i.id');
$ids = $query
->execute()
->fetchCol();
/* @var \Drupal\opigno_group_manager\Entity\OpignoGroupManagedContent[] $opigno_group_managed_contents */
$opigno_group_managed_contents = OpignoGroupManagedContent::loadMultiple($ids);
foreach ($opigno_group_managed_contents as $opigno_group_managed_content) {
$opigno_group_managed_content
->delete();
}
}