I was running/showing drupalmoduleupgrader for a team, and ran into an issue where they had a module that implemented hook_block_info(). Then defined blocks based on a list in separate database. Unfortunately I cannot share this version of the module at the moment.

This is something that would eventually translate into block configuration.

In any case, drupal module upgrader should catch PDOExceptions when evaluating or executing code.

I'm not sure if this is related, but also got the following exceptions generated when running dmu-upgrade on this particular module. This may be unrelated.

Analyzing the module worked great! ;-)

array_shift() expects parameter 1 to be array, object given ParameterMap.php:39                                               [warning]
PHP Fatal error:  Call to a member function getValue() on a non-object in /var/www/drupal8.dev/modules/drupalmoduleupgrader/src/Converter/Routing/ParameterBinding.php on line 132
PHP Stack trace:
PHP   1. {main}() /usr/share/drush/drush.php:0
PHP   2. drush_main() /usr/share/drush/drush.php:16
PHP   3. Drush\Boot\DrupalBoot->bootstrap_and_dispatch() /usr/share/drush/drush.php:76
PHP   4. drush_dispatch() /usr/share/drush/lib/Drush/Boot/DrupalBoot.php:46
PHP   5. call_user_func_array:{/usr/share/drush/includes/command.inc:178}() /usr/share/drush/includes/command.inc:178
PHP   6. drush_command() /usr/share/drush/includes/command.inc:178
PHP   7. _drush_invoke_hooks() /usr/share/drush/includes/command.inc:210
PHP   8. call_user_func_array:{/usr/share/drush/includes/command.inc:359}() /usr/share/drush/includes/command.inc:359
PHP   9. drush_drupalmoduleupgrader_dmu_upgrade() /usr/share/drush/includes/command.inc:359
PHP  10. Drupal\drupalmoduleupgrader\Plugin\DMU\Converter\Routing->convert() /var/www/drupal8.dev/modules/drupalmoduleupgrader/drupalmoduleupgrader.drush.inc:327
PHP  11. Drupal\drupalmoduleupgrader\Plugin\DMU\Routing\ContentRoute->buildRoute() /var/www/drupal8.dev/modules/drupalmoduleupgrader/src/Plugin/DMU/Converter/Routing.php:67
PHP  12. Drupal\drupalmoduleupgrader\Plugin\DMU\Routing\ContentRoute->buildRouteDefinition() /var/www/drupal8.dev/modules/drupalmoduleupgrader/src/Plugin/DMU/Routing/ContentRoute.php:176
PHP  13. Drupal\drupalmoduleupgrader\Plugin\DMU\Routing\ContentRoute->buildParameterMap() /var/www/drupal8.dev/modules/drupalmoduleupgrader/src/Plugin/DMU/Routing/ContentRoute.php:144
PHP  14. Drupal\drupalmoduleupgrader\Converter\Routing\ParameterMap->__construct() /var/www/drupal8.dev/modules/drupalmoduleupgrader/src/Plugin/DMU/Routing/ContentRoute.php:131
PHP  15. Drupal\drupalmoduleupgrader\Converter\Routing\ParameterMap->addBinding() /var/www/drupal8.dev/modules/drupalmoduleupgrader/src/Converter/Routing/ParameterMap.php:39
PHP  16. Drupal\drupalmoduleupgrader\Converter\Routing\ParameterBinding->getValue() /var/www/drupal8.dev/modules/drupalmoduleupgrader/src/Converter/Routing/ParameterMap.php:89

Fatal error: Call to a member function getValue() on a non-object in /var/www/drupal8.dev/modules/drupalmoduleupgrader/src/Converter/Routing/ParameterBinding.php on line 132

Call Stack:
    0.0003     233760   1. {main}() /usr/share/drush/drush.php:0
    0.0177    2459072   2. drush_main() /usr/share/drush/drush.php:16
    0.1217    7053768   3. Drush\Boot\DrupalBoot->bootstrap_and_dispatch() /usr/share/drush/drush.php:76
    0.3640   19539472   4. drush_dispatch() /usr/share/drush/lib/Drush/Boot/DrupalBoot.php:46
    0.3651   19543896   5. call_user_func_array:{/usr/share/drush/includes/command.inc:178}() /usr/share/drush/includes/command.inc:178
    0.3651   19544232   6. drush_command() /usr/share/drush/includes/command.inc:178
    0.3653   19545024   7. _drush_invoke_hooks() /usr/share/drush/includes/command.inc:210
    0.3667   19600968   8. call_user_func_array:{/usr/share/drush/includes/command.inc:359}() /usr/share/drush/includes/command.inc:359
    0.3667   19601304   9. drush_drupalmoduleupgrader_dmu_upgrade() /usr/share/drush/includes/command.inc:359
    2.5356   46679248  10. Drupal\drupalmoduleupgrader\Plugin\DMU\Converter\Routing->convert() /var/www/drupal8.dev/modules/drupalmoduleupgrader/drupalmoduleupgrader.drush.inc:327
    2.5517   47377824  11. Drupal\drupalmoduleupgrader\Plugin\DMU\Routing\ContentRoute->buildRoute() /var/www/drupal8.dev/modules/drupalmoduleupgrader/src/Plugin/DMU/Converter/Routing.php:67
    2.5517   47378648  12. Drupal\drupalmoduleupgrader\Plugin\DMU\Routing\ContentRoute->buildRouteDefinition() /var/www/drupal8.dev/modules/drupalmoduleupgrader/src/Plugin/DMU/Routing/ContentRoute.php:176
    2.5524   47475544  13. Drupal\drupalmoduleupgrader\Plugin\DMU\Routing\ContentRoute->buildParameterMap() /var/www/drupal8.dev/modules/drupalmoduleupgrader/src/Plugin/DMU/Routing/ContentRoute.php:144
    2.8668   52205888  14. Drupal\drupalmoduleupgrader\Converter\Routing\ParameterMap->__construct() /var/www/drupal8.dev/modules/drupalmoduleupgrader/src/Plugin/DMU/Routing/ContentRoute.php:131
    2.8679   52229656  15. Drupal\drupalmoduleupgrader\Converter\Routing\ParameterMap->addBinding() /var/www/drupal8.dev/modules/drupalmoduleupgrader/src/Converter/Routing/ParameterMap.php:39
    2.8679   52229888  16. Drupal\drupalmoduleupgrader\Converter\Routing\ParameterBinding->getValue() /var/www/drupal8.dev/modules/drupalmoduleupgrader/src/Converter/Routing/ParameterMap.php:89

Drush command terminated abnormally due to an unrecoverable error.                                                            [error]
Error: Call to a member function getValue() on a non-object in
/var/www/drupal8.dev/modules/drupalmoduleupgrader/src/Converter/Routing/ParameterBinding.php, line 132

Comments

phenaproxima’s picture

Interesting. DMU should generally refuse, flat-out, to execute any hook which has logic in it (such as database calls). It is at all possible for you to share the code of only the hook_block_info() you tried to convert? (I understand if that's not cool, but it'd help to debug what went awry here.)

webchick’s picture

Status: Active » Postponed (maintainer needs more info)
mradcliffe’s picture

Status: Postponed (maintainer needs more info) » Active

Looks like it's doing db_query() directly and not db_select(). That may be it?

function modulename_block_info() {

  $query = "SELECT lid, list_id, list_name, description, realm FROM {modulename_list} where active = 1";
  $lists = db_query($query)->fetchAll();

mradcliffe’s picture

Does db_query()->fetchAll() match ObjectMethodCallNode or ClassMethodCallNode?