Describe your bug or feature request.

When I go in the coupon page I've got the next error:

The website encountered an unexpected error. Please try again later.
TypeError: Argument 1 passed to Drupal\commerce_promotion\CouponStorage::loadMultipleByPromotion() must be an instance of Drupal\commerce_promotion\Entity\PromotionInterface, string given, called in /var/www/web/modules/contrib/commerce/modules/promotion/src/CouponListBuilder.php on line 77 in Drupal\commerce_promotion\CouponStorage->loadMultipleByPromotion() (line 24 of modules/contrib/commerce/modules/promotion/src/CouponStorage.php).
Drupal\commerce_promotion\CouponStorage->loadMultipleByPromotion('34') (Line: 77)
Drupal\commerce_promotion\CouponListBuilder->load() (Line: 218)
Drupal\Core\Entity\EntityListBuilder->render() (Line: 23)
Drupal\Core\Entity\Controller\EntityListController->listing('commerce_promotion_coupon')
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 578)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 158)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 80)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 52)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 716)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

If a bug, provide steps to reproduce it from a clean install.

Drupal 9.2, PHP 7.3, Comercce - 2.25

1. Create promotion.
2. Go to promotion coupons page.
3. Get the errors

CommentFileSizeAuthor
error_CouponListBuilder_load.patch983 bytesUSandul

Issue fork commerce-3224676

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

USandul created an issue. See original summary.

Renrhaf made their first commit to this issue’s fork.

Renrhaf’s picture

Here is a different patch, changing the route parameter so that we directly get a Promotion entity instead of an identifier.

  • Renrhaf committed 3f69ebd on 8.x-2.x
    Fixing #3224676 : fatal error on the coupon list page
jsacksick’s picture

Priority: Critical » Normal
Status: Needs review » Fixed

This is probably due to the fact that you're not using the view for the lists for some reason, but the regular coupon list builder which is odd.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.