Problem/Motivation

When try to do Bulk delete URL alias from the Pathauto module (admin/config/search/path/delete_bulk) for the External Entity its looking for the table {url_alias} and cause below error:

Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'url_alias' doesn't exist: SELECT COUNT(*) AS expression FROM (SELECT 1 AS expression FROM {url_alias} ua WHERE (ua.source LIKE :db_condition_placeholder_0 ESCAPE '\\') AND (ua.source NOT LIKE :db_condition_placeholder_1 ESCAPE '\\') AND (ua.pid > :db_condition_placeholder_2)) subquery; Array ( [:db_condition_placeholder_0] => /XXXX/% [:db_condition_placeholder_1] => /XXXX/%/% [:db_condition_placeholder_2] => 0 ) in Drupal\external_entities_pathauto\Plugin\pathauto\AliasType\ExternalEntityAliasTypeBase->batchDelete() (line 94 of modules/contrib/external_entities/modules/external_entities_pathauto/src/Plugin/pathauto/AliasType/ExternalEntityAliasTypeBase.php).

see the following change record: https://www.drupal.org/node/3013865

Steps to reproduce

  • After enable the External entities and added some content with automated URL alias.
  • Go to the pathauto config page, (admin/config/search/path/patterns) if the pathauto module not exist please install the module to access the page.
  • Go to the Delete Aliases tag (admin/config/search/path/delete_bulk)
  • Select your external entity from the CHOOSE ALIASES TO DELETE
  • Check the Only delete automatically generated aliases checkbox and click delete aliases

Proposed resolution

Change the table name from {url_alias} to {path_alias} in the batchDelete function in external_entities/modules/external_entities_pathauto/src/Plugin/pathauto/AliasType/ExternalEntityAliasTypeBase.php

Remaining tasks

User interface changes

API changes

Data model changes

Command icon 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

VishnuTRZ created an issue. See original summary.

vishnutrz’s picture

The Patch change the table name from {url_alias} to {path_alias} and its column name.

pefferen made their first commit to this issue’s fork.

pefferen’s picture

Thanks @VishnuTRZ I created an issue fork and altered also the table aliases to meet the new table name for consistency.

pefferen’s picture

Issue summary: View changes
pefferen’s picture

Version: 8.x-2.0-alpha3 » 8.x-2.x-dev
Assigned: vishnutrz » Unassigned
Status: Active » Needs review
pgrond’s picture

Status: Needs review » Needs work

The patch works for me. The only thing that I find odd, is that the bulk generation of aliases for external entities will not add an entry to the key_value store to mark the alias as handled by pathauto. Deleting generated aliases for external entities now only works when the " Only delete automatically generated aliases" is unchecked.

But than again, do we want to store any information in Drupal for external entities? Maybe not and than this is expected behaviour. Maybe try to ignore that checkbox when deleting aliases for external entities?

pefferen’s picture

Status: Needs work » Reviewed & tested by the community

  • pefferen committed 02ac22d0 on 8.x-2.x
    fix: #3269431 Bulk deleting URL aliases For External Entity
    
    By:...
pefferen’s picture

Status: Reviewed & tested by the community » Fixed

Merged to 2.x branch, thanks all!

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.