public static function UpdateStatusEntities::updateStatusEntities in CMS Content Sync 2.1.x
Same name and namespace in other branches
- 8 modules/cms_content_sync_views/src/Controller/UpdateStatusEntities.php \Drupal\cms_content_sync_views\Controller\UpdateStatusEntities::updateStatusEntities()
- 2.0.x modules/cms_content_sync_views/src/Controller/UpdateStatusEntities.php \Drupal\cms_content_sync_views\Controller\UpdateStatusEntities::updateStatusEntities()
Batch process callback for module installation to update status entities with the required reference.
Parameters
$ids:
$context:
Throws
\Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException
\Drupal\Component\Plugin\Exception\PluginNotFoundException
\Drupal\Core\Entity\EntityStorageException
File
- modules/
cms_content_sync_views/ src/ Controller/ UpdateStatusEntities.php, line 23
Class
- UpdateStatusEntities
- Update status entities.
Namespace
Drupal\cms_content_sync_views\ControllerCode
public static function updateStatusEntities($ids, &$context) {
$status_entity_storage = \Drupal::entityTypeManager()
->getStorage('cms_content_sync_entity_status');
foreach ($ids as $id) {
$status_info_entity = $status_entity_storage
->load($id);
$referenced_entity = \Drupal::service('entity.repository')
->loadEntityByUuid($status_info_entity
->get('entity_type')->value, $status_info_entity
->get('entity_uuid')->value);
$status_info_entity
->set('entity', $referenced_entity);
$status_info_entity
->save();
}
}