Deleted comment entity leads to exceptions
>>> [!note] Migrated issue <!-- Drupal.org comment --> <!-- Migrated from issue #3331533. --> Reported by: [jurgenhaas](https://www.drupal.org/user/168924) >>> <h3 id="summary-problem-motivation">Problem/Motivation</h3> <p>When a comment entity got deleted, DANSE may eventually throw exceptions like these:</p> <pre>TypeError: Drupal\danse\PluginBase::subscriptionKey(): Argument #2 must be of type string, null given, called in /var/www/html/web/modules/contrib/danse/modules/content/src/Payload.php on line 71 in /var/www/html/web/modules/contrib/danse/src/PluginBase.php on line 267 #0 /var/www/html/web/modules/contrib/danse/modules/content/src/Payload.php(71): Drupal\danse\PluginBase-&gt;subscriptionKey()<br>#1 /var/www/html/web/modules/contrib/danse/src/PluginBase.php(351): Drupal\danse_content\Payload-&gt;getSubscriptionReferences()<br>#2 /var/www/html/web/modules/contrib/danse/src/PluginBase.php(196): Drupal\danse\PluginBase-&gt;getSubscribers()<br>#3 /var/www/html/web/modules/contrib/danse/src/Service.php(311): Drupal\danse\PluginBase-&gt;createNotifications()<br>#4 /var/www/html/web/modules/contrib/danse/danse.module(29): Drupal\danse\Service-&gt;createNotifications()<br>#5 /var/www/html/web/core/lib/Drupal/Core/Cron.php(249): danse_cron()<br>#6 /var/www/html/web/core/lib/Drupal/Core/Extension/ModuleHandler.php(405): Drupal\Core\Cron-&gt;Drupal\Core\{closure}()<br>#7 /var/www/html/web/core/lib/Drupal/Core/Cron.php(257): Drupal\Core\Extension\ModuleHandler-&gt;invokeAllWith()<br>#8 /var/www/html/web/core/lib/Drupal/Core/Cron.php(136): Drupal\Core\Cron-&gt;invokeCronHandlers()<br>#9 /var/www/html/web/core/lib/Drupal/Core/ProxyClass/Cron.php(75): Drupal\Core\Cron-&gt;run()<br>#10 /var/www/html/vendor/drush/drush/src/Drupal/Commands/core/DrupalCommands.php(67): Drupal\Core\ProxyClass\Cron-&gt;run()<br>#11 [internal function]: Drush\Drupal\Commands\core\DrupalCommands-&gt;cron()<br>#12 /var/www/html/vendor/consolidation/annotated-command/src/CommandProcessor.php(257): call_user_func_array()<br>#13 /var/www/html/vendor/consolidation/annotated-command/src/CommandProcessor.php(212): Consolidation\AnnotatedCommand\CommandProcessor-&gt;runCommandCallback()<br>#14 /var/www/html/vendor/consolidation/annotated-command/src/CommandProcessor.php(176): Consolidation\AnnotatedCommand\CommandProcessor-&gt;validateRunAndAlter()<br>#15 /var/www/html/vendor/consolidation/annotated-command/src/AnnotatedCommand.php(390): Consolidation\AnnotatedCommand\CommandProcessor-&gt;process()<br>#16 /var/www/html/vendor/symfony/console/Command/Command.php(255): Consolidation\AnnotatedCommand\AnnotatedCommand-&gt;execute()<br>#17 /var/www/html/vendor/symfony/console/Application.php(1039): Symfony\Component\Console\Command\Command-&gt;run()<br>#18 /var/www/html/vendor/symfony/console/Application.php(275): Symfony\Component\Console\Application-&gt;doRunCommand()<br>#19 /var/www/html/vendor/symfony/console/Application.php(149): Symfony\Component\Console\Application-&gt;doRun()<br>#20 /var/www/html/vendor/drush/drush/src/Runtime/Runtime.php(124): Symfony\Component\Console\Application-&gt;run()<br>#21 /var/www/html/vendor/drush/drush/src/Runtime/Runtime.php(51): Drush\Runtime\Runtime-&gt;doRun()<br>#22 /var/www/html/vendor/drush/drush/drush.php(77): Drush\Runtime\Runtime-&gt;run()<br>#23 /var/www/html/vendor/drush/drush/includes/preflight.inc(18): require('...')<br>#24 phar:///usr/local/bin/drush/bin/drush.php(143): drush_main()<br>#25 /usr/local/bin/drush(14): require('...')<br>#26 {main}</pre><h3 id="summary-proposed-resolution">Proposed resolution</h3> <p>Avoid this type of exception by asserting the referenced entity to be available.</p>
issue