Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix config:delete() to be safer and more powerful when working with config entities #5886

Open
alexpott opened this issue Mar 4, 2024 · 3 comments

Comments

@alexpott
Copy link
Contributor

alexpott commented Mar 4, 2024

Describe the bug
A clear and concise description of what the bug is.

If you delete a node type via drush:config:delete Drush does this completely unaware of dependencies. It should use the config dependency system to do the delete. It should also delete config entities using the config entity system not the config system.

To Reproduce
drush config:delete node.type.article

Expected behavior
I expect Drush to warn me that there are dependencies and to work out if the config entity can be removed the same way Drupal core would - see \Drupal\Core\Config\Entity\ConfigDependencyDeleteFormTrait::addDependencyListsToForm

Actual behavior
It deletes the config entity using \Drupal\Core\Config\Config::delete() which is wrong because it is entity... so none of the entity hooks fire and wrong because we don't manage dependencies.

Workaround
Nope

System Configuration

Q A
Drush version? 12.x/11.x/10.x/8.x (please be specific, and try latest release)
Drupal version? 10.x/9.x/8.x/7.x
PHP version 8.x/7.x
OS? Mac/Linux/Windows

Additional information
Add any other context about the problem here.

@weitzman
Copy link
Member

Makes sense. I'm not sure how far we should take config edit functionality. For example, we have config:set and config:edit which also perform no validation.

@weitzman
Copy link
Member

Ideally Drupal core would provide a service for retrieving the changelist, similar to \Drupal\Core\Config\StorageComparer. Without the service, Drush has to get a bit tangled with the implementation.

@alexpott
Copy link
Contributor Author

\Drupal\Core\Config\ConfigManagerInterface::getConfigEntitiesToChangeOnDependencyRemoval() is here for you... even tells you what it is going to do when you delete the entity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants