public function FileUsageMigrateSubscriber::onPreMigrateFileUsage in Multiversion 8
Remove file usage records associated with the migrated entity type.
Parameters
\Drupal\multiversion\Event\MultiversionManagerEvent $event:
File
- src/
EventSubscriber/ FileUsageMigrateSubscriber.php, line 46
Class
- FileUsageMigrateSubscriber
- FileUsageMigrateSubscriber class.
Namespace
Drupal\multiversion\EventSubscriberCode
public function onPreMigrateFileUsage(MultiversionManagerEvent $event) {
if ($this->moduleHandler
->moduleExists('file')) {
foreach ($event
->getEntityTypes() as $entity_type) {
$type = $entity_type
->id();
$this->connection
->delete('file_usage')
->condition('type', $type)
->execute();
}
}
}