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

Add Drupal Dependencies commands to Drush core #6060

Merged
merged 9 commits into from
Nov 19, 2024
Merged

Conversation

claudiu-cristea
Copy link
Member

@claudiu-cristea claudiu-cristea force-pushed the drupal-dependencies branch 3 times, most recently from aed0bf2 to 63b4944 Compare July 13, 2024 11:00
@claudiu-cristea
Copy link
Member Author

Blocked on #6061

@claudiu-cristea
Copy link
Member Author

Unblocking. Resolving w/o #6061 for now

@claudiu-cristea claudiu-cristea force-pushed the drupal-dependencies branch 2 times, most recently from b8bda10 to 8956987 Compare November 3, 2024 09:50
@claudiu-cristea
Copy link
Member Author

Ok, let's see what Drush maintainers have to say.

In the future we can expand with more why:* commands, such as getting the container services dependencies, Drupal libraries dependencies, etc.

Copy link
Member

@weitzman weitzman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job on the tests. I have just nits.


Drupal modules are able to define other modules as dependencies, using the module's [metadata info.yml file](https://www.drupal.org/docs/develop/creating-modules/let-drupal-know-about-your-module-with-an-infoyml-file). To get all modules that depend on a given module type:

drush why:module node --dependent-type=module
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about just --type? Its briefer, and easier to spell.

Comment on lines 31 to 38
private array $dependents = [];
private array $tree = [];
private array $relation = [];
private array $dependencies = [
'module-module' => [],
'config-module' => [],
'config-config' => [],
];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PHPDoc for these would be helpful IMO

Comment on lines 209 to 212
/**
* @param string $dependency
* @param array $path
*/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets do a 1 line summary of the method, and omit phpdoc on params if they add nothing above whats in the function signature. Same for methods below.

{
$entityTypeManager = \Drupal::entityTypeManager();
$configTypeIds = array_keys(
array_filter($entityTypeManager->getDefinitions(), function (EntityTypeInterface $entityType): bool {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you improve readability with an arrow function here? https://medium.com/@albertcolom/how-to-use-arrow-function-in-php-c28490ff7fb7

{
return new self(
$container->get('extension.list.module'),
$container->getParameter('container.modules')
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This container param I wanted to autowire, so I've opened #6061

@claudiu-cristea
Copy link
Member Author

Ready for a 2nd round of review

@weitzman
Copy link
Member

weitzman commented Nov 6, 2024

This looks great to me. I will merge in a day or two unless we get more discussion here.

@weitzman weitzman merged commit f17a1d7 into 13.x Nov 19, 2024
1 check passed
@weitzman weitzman deleted the drupal-dependencies branch November 19, 2024 19:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants