From d1fa26f796547b9f59d8d7f36764cb19f8d7a2f3 Mon Sep 17 00:00:00 2001 From: Moshe Weitzman Date: Sat, 9 Mar 2024 17:17:24 -0500 Subject: [PATCH] Docs tweak --- docs/dependency-injection.md | 11 ++++++----- docs/site-alias-manager.md | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/docs/dependency-injection.md b/docs/dependency-injection.md index f825b3f839..f71d65ac69 100644 --- a/docs/dependency-injection.md +++ b/docs/dependency-injection.md @@ -40,12 +40,13 @@ See the [Drupal Documentation](https://www.drupal.org/docs/drupal-apis/services- createEarly() method ------------------ :octicons-tag-24: 12.0+ -!!! tip - Drush 12 supported a createEarly() method. This is deprecated and instead put a `#[CLI\Bootstrap(DrupalBootLevels::NONE)]` Attribute on the command class and inject dependencies via the usual `__construct` with [AutowireTrait](https://github.com/drush-ops/drush/blob/13.x/src/Commands/AutowireTrait.php). Note also that Drush commands packaged with Drupal modules are not discovered - until after Drupal bootstraps, and therefore cannot use `createEarly()`. This - mechanism is only usable by PSR-4 discovered commands packaged with Composer - projects that are *not* Drupal modules. +Drush 12 supported a `createEarly()` method. This is deprecated and instead put a `#[CLI\Bootstrap(DrupalBootLevels::NONE)]` Attribute on the command class and inject dependencies via the usual `__construct()` and [AutowireTrait](https://github.com/drush-ops/drush/blob/13.x/src/Commands/AutowireTrait.php). + +Note also that Drush commands packaged with Drupal modules are not discovered +until after Drupal bootstraps, and therefore cannot use `createEarly()`. This +mechanism is only usable by PSR-4 discovered commands packaged with Composer +projects that are *not* Drupal modules. Inflection diff --git a/docs/site-alias-manager.md b/docs/site-alias-manager.md index 2f25a43a78..f931a56bb9 100644 --- a/docs/site-alias-manager.md +++ b/docs/site-alias-manager.md @@ -4,7 +4,7 @@ Site Alias Manager The [Site Alias Manager (SAM)](https://github.com/consolidation/site-alias/blob/4.0.1/src/SiteAliasManager.php) service is used to retrieve information about one or all of the site aliases for the current installation. - An informative example is the [browse command](https://github.com/drush-ops/drush/blob/12.x/src/Commands/core/BrowseCommands.php) -- A commandfile gets access to the SAM as follows: +- A commandfile gets usually access to the SAM via [autowire](dependency-injection.md#autowire) of a dependency: ```php #[Autowire(service: DependencyInjection::SITE_ALIAS_MANAGER)] private readonly SiteAliasManagerInterface $siteAliasManager