protected function MediaMigrationDatabaseTrait::getWebformOrUserPictureOnlyFidsQuery in Media Migration 8
Subquery for FIDs used only in webform submissions and/or by user entities.
Parameters
\Drupal\Core\Database\Connection $connection: Database connection of the source Drupal 7 instance.
Return value
\Drupal\Core\Database\Query\SelectInterface Query that gets the FIDs of files used only in webform submissions.
2 calls to MediaMigrationDatabaseTrait::getWebformOrUserPictureOnlyFidsQuery()
- MediaMigrationDatabaseTrait::getFileEntityBaseQuery in src/
Plugin/ migrate/ source/ d7/ MediaMigrationDatabaseTrait.php - Returns a base query for file entity types.
- MediaMigrationDatabaseTrait::getFilePlainBaseQuery in src/
Plugin/ migrate/ source/ d7/ MediaMigrationDatabaseTrait.php - Returns a base query for plain files.
File
- src/
Plugin/ migrate/ source/ d7/ MediaMigrationDatabaseTrait.php, line 169
Class
- MediaMigrationDatabaseTrait
- MediaMigrationDatabaseTrait.
Namespace
Drupal\media_migration\Plugin\migrate\source\d7Code
protected function getWebformOrUserPictureOnlyFidsQuery(Connection $connection) {
$query = $connection
->select('file_usage', 'fu');
$query
->fields('fu', [
'fid',
]);
$query
->groupBy('fu.fid');
$wf_type_concat_expression = $connection instanceof PostgreSqlConnection ? "STRING_AGG(DISTINCT fu.type, ',')" : "GROUP_CONCAT(DISTINCT fu.type)";
$query
->having("{$wf_type_concat_expression} = :allowed_type_submission_only OR {$wf_type_concat_expression} = :allowed_type_submission_user_only OR {$wf_type_concat_expression} = :allowed_type_user_submission_only", [
':allowed_type_submission_only' => 'submission',
':allowed_type_submission_user_only' => 'submission,user',
':allowed_type_user_submission_only' => 'user,submission',
]);
return $query;
}