Skip to content

Commit

Permalink
Docs tweak
Browse files Browse the repository at this point in the history
  • Loading branch information
weitzman committed Mar 9, 2024
1 parent bb5620b commit d1fa26f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
11 changes: 6 additions & 5 deletions docs/dependency-injection.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion docs/site-alias-manager.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d1fa26f

Please sign in to comment.