You are here

protected function EntityFile::getOverwriteMode in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/file/src/Plugin/migrate/destination/EntityFile.php \Drupal\file\Plugin\migrate\destination\EntityFile::getOverwriteMode()

Determines how to handle file conflicts.

Parameters

\Drupal\migrate\Row $row:

Return value

integer Either FILE_EXISTS_REPLACE (default) or FILE_EXISTS_RENAME, depending on the current configuration.

1 call to EntityFile::getOverwriteMode()
EntityFile::import in core/modules/file/src/Plugin/migrate/destination/EntityFile.php
Import the row.

File

core/modules/file/src/Plugin/migrate/destination/EntityFile.php, line 177
Contains \Drupal\file\Plugin\migrate\destination\EntityFile.

Class

EntityFile
Every migration that uses this destination must have an optional dependency on the d6_file migration to ensure it runs first.

Namespace

Drupal\file\Plugin\migrate\destination

Code

protected function getOverwriteMode(Row $row) {
  if (!empty($this->configuration['rename'])) {
    $entity_id = $row
      ->getDestinationProperty($this
      ->getKey('id'));
    if ($entity_id && ($entity = $this->storage
      ->load($entity_id))) {
      return FILE_EXISTS_RENAME;
    }
  }
  return FILE_EXISTS_REPLACE;
}