URL Generator Error on Entity Migration

Created on 26 March 2020, over 4 years ago
Updated 21 June 2023, over 1 year ago

Problem/Motivation

When running migrations, I am setting the status on both the product itself and its variations, the first time everything runs correctly. However, if the status is set to 0, I cannot set it again. I get an error stating that the URL does not match:

Symfony\Component\Routing\Exception\InvalidParameterException: Parameter "commerce_product" for route "entity.commerce_product.canonical" must match "\d+" ("sku" given) to generate a           [error]
corresponding URL. in Drupal\Core\Routing\UrlGenerator->doGenerate() (line 204 of /Users/huett026/Sites/devdesktop/umnbookstore8-test/docroot/core/lib/Drupal/Core/Routing/UrlGenerator.php).
Parameter "commerce_product" for route "entity.commerce_product.canonical" must match "\d+" ("sku" given) to generate a corresponding URL.                                                       [error]
(/Users/huett026/Sites/devdesktop/umnbookstore8-test/docroot/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php:846)

It does not seem to matter if the value is set in the file I'm using to migrate or from a custom plugin. I was expecting to be able to set the status based on the status of the variations, but it does not seem to work as expected. To reproduce this error, migrate a product with the status set to zero and then rerun the migration with the status set to either 0 or 1, and the migration will fail.
I was wondering if there was something I was missing, and where the issue actually is, if its drupal commerce related or Drupal core, please let me know.
Thanks,

Jackson

Steps to reproduce

migrate a product with the status set to zero and then rerun the migration with the status set to either 0 or 1, and the migration will fail.

Proposed resolution

πŸ› Bug report
Status

Closed: works as designed

Version

2.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States jwhuettl

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024