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
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | Bulk-deleting-URL-aliases-For-External-Entity-3269431-2.patch | 1.56 KB | vishnutrz |
Issue fork external_entities-3269431
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
Comment #2
vishnutrz commentedThe Patch change the table name from {url_alias} to {path_alias} and its column name.
Comment #4
pefferen commentedThanks @VishnuTRZ I created an issue fork and altered also the table aliases to meet the new table name for consistency.
Comment #6
pefferen commentedComment #7
pefferen commentedComment #8
pgrond commentedThe 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?
Comment #9
pefferen commentedComment #11
pefferen commentedMerged to 2.x branch, thanks all!