Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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
Comment | File | Size | Author |
---|---|---|---|
error_CouponListBuilder_load.patch | 983 bytes | USandul | |
Issue fork commerce-3224676
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:
Comments
Comment #4
RenrhafHere is a different patch, changing the route parameter so that we directly get a Promotion entity instead of an identifier.
Comment #6
jsacksick CreditAttribution: jsacksick at Centarro commentedThis 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.