pathauto unable to bulk generate paths when using a separate database for civicrm

Created on 13 February 2024, 4 months ago
Updated 9 May 2024, about 2 months ago

Problem/Motivation

When trying to regenerate pathauto aliases in bulk, the process will fail if you are using a separate database for civicrm data.

Steps to reproduce

Try to regenerate aliases for CiviCRM Event entities.
This returns an error page with a 500 response from the batch job.
Checking the logs, the following error message is found:
Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'drupal.civicrm_event' doesn't exist: SELECT COUNT(*) AS "expression" FROM (SELECT 1 AS "expression" FROM "civicrm_event" "base_table" LEFT OUTER JOIN "path_alias" "pa" ON CONCAT('/civicrm-event/' , base_table.id) = pa.path WHERE "base_table"."id" > :db_condition_placeholder_0) "subquery"; Array ( [:db_condition_placeholder_0] => 0 ) in Drupal\pathauto\Plugin\pathauto\AliasType\EntityAliasTypeBase->batchUpdate() (line 177 of /var/www/public_html/web/modules/contrib/pathauto/src/Plugin/pathauto/AliasType/EntityAliasTypeBase.php).
In this case drupal is the name of the database for drupal data and civicrm is the name of the database for civicrm data.

I do have the following in my settings.php in drupal:
$databases['civicrm']['default']['database'] = "civicrm";
but this doesn't seem to help.

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Fixed

Version

3.0

Component

Code

Created by

πŸ‡¦πŸ‡ΊAustralia nicholosophy Brisbane

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.69.0 2024