8 – Is the path_alias table queried for all URLs?

I'm trying to generate SEO-optimized URLs for a set of exposed filters. For example:

/analyst-relations/firm?related_firm=5072 would look like

/analyst-relations/firm/forrester

I imagined doing this by adding / updating / deleting this path programmatically to the path_alias table when creating / modifying / deleting the term or the relevant entity. However, I seem to have misunderstood how path_alias works. I managed to add the path /analyst-relations/firm?related_firm=5072 and alias /analyst-relations/firm/forrester, but the exposed filter links always load like the first ones. Is the path_alias table not queried for all URLs? If not, is it possible to somehow “link” this path and this alias to an entity?

EDIT:
I use better exposed filters to expose the filters as links, so afaik there is no form submission

8 – Delete the path_alias entity by language

We are running Drupal 8.8.5. I can see duplicate aliases when I watch

/ admin / config / search / path

unfortunately there are many duplicate aliases on our website with 6000 URLs. The node with the path & # 39; / node / 1 & # 39; has three translations: & # 39; en & # 39 ;, & # 39; es & # 39; and & # 39; zh-hans & # 39;. & # 39; / node / 1 & # 39; also has a second entrance for & # 39; es & # 39; containing a duplicate path / alias that I would like to remove.

I need to find a way to fix this under the control of the program. If I have CRUD (Create, Read, Update and Delete) operations on the path / alias / langcode, I can create a solution to eliminate duplicates.

The following gets the alias data associated with the node with nest = 1 and clears the path, alias and LangCode:

$alias = Drupal::entityTypeManager()->getStorage('path_alias')->load('1');
var_dump($alias->getPath());
var_dump($alias->getAlias());
var_dump($alias->language()->getId());

The basic language of the website is English and the last var_dump returns "en". So far so good.

How can I access alias data for these two languages? I know the following works work:

$alias_es = Drupal::service('path_alias.manager')->getAliasByPath('/node/1','es');

I need to delete the duplicate Spanish alias to achieve my goal, so I need to understand how to use entities that have a delete () method. You might think the following would work:

$alias_es = $alias->getTranslation('es');

It returns "InvalidArgumentException: specified invalid translation language (s).". I also tried:

$alias->getTranslationLanguages();

which returns an array with a single element (& # 39; en & # 39;) => object (Drupal Core Language Language).

It seems that our original

$alias = Drupal::entityTypeManager()->getStorage('path_alias')->load('1');

there is only one translation in english language. How do I access alias entities for & # 39; s & # 39; and & # 39; zh-hans & # 39 ;?