Skip to content
Snippets Groups Projects

Resolve #3104268 "Sync id too strict3"

1 unresolved thread

Closes #3104268

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
82 83 * Migration ID.
83 84 * @param array $sourceIds
84 85 * A set of SyncSourceIds. Gets serialized to retain its structure.
86 * @param \Drupal\migrate\Plugin\MigrateSourceInterface $source
87 * The migrate source.
85 88 *
86 89 * @throws \Exception
87 90 */
88 public function addToSyncSourceIds(string $migrationId, array $sourceIds): void {
91 public function addToSyncSourceIds(string $migrationId, array $sourceIds, MigrateSourceInterface $source): void {
  • Let's mark this class as @internal. It should have been already marked that way, but it wasn't. Since we didn't though, can we make this argument optional and do the BC dance?

  • We don't really need to pass the source here, \Drupal::service('plugin.manager.migration')->createInstance($migrationId)->getSourcePlugin() would do it. If anything, I would do the BC dance to change the migration id parameter to take the migration object instead to avoid needing to call the plugin manager.

  • Suggested change
    91 public function addToSyncSourceIds(string $migrationId, array $sourceIds, MigrateSourceInterface $source): void {
    92 $sourceIds = $this->prepareSourceIdValues($sourceIds, $source);
    93 $this->bufferedSyncIdsEntries[] = [
    94 'migration_id' => $migrationId,
    91 public function addToSyncSourceIds(MigrationInterface|string $migration, array $sourceIds): void {
    92 if (!$migration instanceof MigrationInterface) {
    93 $migration = \Drupa::service('plugin.manager.migration')->createInstance($migration);
    94 trigger_error("addToSyncSourceIds will require a migration object...", E_USER_DEPRECATED);
    95 }
    96 $sourceIds = $this->prepareSourceIdValues($sourceIds, $migration->getSourcePlugin());
    97 $this->bufferedSyncIdsEntries[] = [
    98 'migration_id' => $migration->id(),
  • $migration = \Drupa::service('plugin.manager.migration')->createInstance($migration);

    But this isn't the same no? MigratePluginManager::createInstance() accepts both plugin ID and configuration. So we also need to find the configuration for it and pass that in too right? Hard to tell, the arg exists but core does not make use of it in core/migrate/, but I imagine it must exist for a reason... maybe contrib is using

  •     $this->bufferedSyncIdsEntries[] = [
          'migration_id' => $migration->id(),

    Will change this to

        $this->bufferedSyncIdsEntries[] = [
          'migration_id' => $migration->getPluginId(),

    to match what is currently happening in migrate_tools_migrate_prepare_row() (which is to pass plugin ID, not ID)

  • Scott Euser changed this line in version 2 of the diff

    changed this line in version 2 of the diff

  • Please register or sign in to reply
  • Scott Euser added 1 commit

    added 1 commit

    • a93a92e7 - Change to getting migrate object rather than adding additional argument

    Compare with previous version

  • Scott Euser added 1 commit

    added 1 commit

    • 777d6833 - Update deprecation to match coding standards

    Compare with previous version

  • Scott Euser added 1 commit

    added 1 commit

    • 9a4704eb - Ignore lack of dependency injection in deprecation call

    Compare with previous version

  • Scott Euser added 1 commit

    added 1 commit

    Compare with previous version

  • Scott Euser added 1 commit

    added 1 commit

    Compare with previous version

  • Please register or sign in to reply
    Loading