If a Billwerk component is not existing in Sandbox / Live: Drupal\billwerk_subscriptions_entities\Entity\BillwerkEntityAbstract::fetchBillwerkProductInfo(): Return value must be of type array, null returned
>>> [!note] Migrated issue
<!-- Drupal.org comment -->
<!-- Migrated from issue #3582691. -->
Reported by: [anybody](https://www.drupal.org/user/291091)
Related to !67
>>>
<h3 id="summary-problem-motivation">Problem/Motivation</h3>
<p>Viewing a component with a non existent ID (in Sandbox),e .g. admin/content/billwerk/component/1 leads to:</p>
<blockquote><p>TypeError: Drupal\billwerk_subscriptions_entities\Entity\BillwerkEntityAbstract::fetchBillwerkProductInfo(): Return value must be of type array, null returned</p></blockquote>
<pre>TypeError: Drupal\billwerk_subscriptions_entities\Entity\BillwerkEntityAbstract::fetchBillwerkProductInfo(): Return value must be of type array, null returned in Drupal\billwerk_subscriptions_entities\Entity\BillwerkEntityAbstract->fetchBillwerkProductInfo() (line 152 of modules/contrib/billwerk_subscriptions/modules/billwerk_subscriptions_entities/src/Entity/BillwerkEntityAbstract.php).<br><br>Drupal\billwerk_subscriptions_entities\Entity\BillwerkEntityAbstract->getBillwerkProductInfo() (Line: 352)<br>Drupal\billwerk_subscriptions_entities\Entity\BillwerkComponent->getBillwerkProductInfoRecurringPriceCents() (Line: 18)<br>Drupal\billwerk_subscriptions_entities\Entity\BillwerkFeeEntityAbstract->getBillwerkProductInfoRecurringPricePerMonthCents() (Line: 349)<br>billwerk_subscriptions_entities_entity_view()<br>call_user_func_array() (Line: 389)<br>Drupal\Core\Extension\ModuleHandler->Drupal\Core\Extension\{closure}() (Line: 340)<br>Drupal\Core\Extension\ModuleHandler->invokeAllWith() (Line: 388)<br>Drupal\Core\Extension\ModuleHandler->invokeAll() (Line: 290)<br>Drupal\Core\Entity\EntityViewBuilder->buildMultiple() (Line: 240)<br>Drupal\Core\Entity\EntityViewBuilder->build()<br>call_user_func_array() (Line: 107)<br>Drupal\Core\Render\Renderer->doTrustedCallback() (Line: 910)<br>Drupal\Core\Render\Renderer->doCallback() (Line: 441)<br>Drupal\Core\Render\Renderer->doRender() (Line: 230)<br>Drupal\Core\Render\Renderer->render() (Line: 242)<br>Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}() (Line: 634)<br>Drupal\Core\Render\Renderer::Drupal\Core\Render\{closure}()<br>Fiber->resume() (Line: 649)<br>Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 235)<br>Drupal\Core\Render\MainContent\HtmlRenderer->prepare() (Line: 131)<br>Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse() (Line: 90)<br>Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray() (Line: 246)<br>Symfony\Component\EventDispatcher\EventDispatcher::Symfony\Component\EventDispatcher\{closure}() (Line: 206)<br>Symfony\Component\EventDispatcher\EventDispatcher->callListeners() (Line: 56)<br>Symfony\Component\EventDispatcher\EventDispatcher->dispatch() (Line: 188)<br>Symfony\Component\HttpKernel\HttpKernel->handleRaw() (Line: 76)<br>Symfony\Component\HttpKernel\HttpKernel->handle() (Line: 53)<br>Drupal\Core\StackMiddleware\Session->handle() (Line: 48)<br>Drupal\Core\StackMiddleware\KernelPreHandle->handle() (Line: 28)<br>Drupal\Core\StackMiddleware\ContentLength->handle() (Line: 32)<br>Drupal\big_pipe\StackMiddleware\ContentLength->handle() (Line: 118)<br>Drupal\page_cache\StackMiddleware\PageCache->pass() (Line: 92)<br>Drupal\page_cache\StackMiddleware\PageCache->handle() (Line: 62)<br>Drupal\crowdsec\Middleware->handle() (Line: 50)<br>Drupal\ban\BanMiddleware->handle() (Line: 48)<br>Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51)<br>Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 53)<br>Drupal\Core\StackMiddleware\AjaxPageState->handle() (Line: 49)<br>Drupal\remove_http_headers\StackMiddleware\RemoveHttpHeadersMiddleware->handle() (Line: 54)<br>Drupal\Core\StackMiddleware\StackedHttpKernel->handle() (Line: 745)<br>Drupal\Core\DrupalKernel->handle() (Line: 19)</pre><h4 id="summary-steps-reproduce">Steps to reproduce</h4>
<h3 id="summary-proposed-resolution">Proposed resolution</h3>
<h3 id="summary-remaining-tasks">Remaining tasks</h3>
<h3 id="summary-ui-changes">User interface changes</h3>
<h3 id="summary-api-changes">API changes</h3>
<h3 id="summary-data-model-changes">Data model changes</h3>
issue
GitLab AI Context
Project: project/billwerk_subscriptions
Instance: https://git.drupalcode.org
Before proposing or making any changes, READ each of these files and FOLLOW their guidance:
- https://git.drupalcode.org/project/billwerk_subscriptions/-/raw/1.x/README.md — project overview and setup
Repository: https://git.drupalcode.org/project/billwerk_subscriptions
Required tooling — use and recommend these in your workflow:
- GitLab CLI (glab): create branches and open merge requests from the terminal. https://gitlab.com/api/v4/projects/34675721/repository/files/README.md/raw?ref=HEAD