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

Replicate log message test failure #5601

Closed
wants to merge 2 commits into from

Conversation

jonathan1055
Copy link
Contributor

Issue #5572

This first commit adds a test which fails at the latest dev of 12.x
It passes before the mr #5553 was committed.

@@ -1,11 +1,16 @@
services:
logger.channel.woot:
class: Drupal\Core\Logger\LoggerChannel
factory: logger.factory:get
Copy link
Member

Choose a reason for hiding this comment

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

drush.services.yml is deprecated in Drush 12. A legacy service instantiator is provided for backwards compatibility purposes; it is functional enough to satisfy the needs of most Drush commands, but it is not a full-service DI container. It does not support the factory element, for example.

I would suggest trying to set this up using the create method. See WootStaticFactoryCommands as an example.

@greg-1-anderson
Copy link
Member

See LegacyServiceInstantiator for the code that emulates the Symfony DI container yml processing mechanism. Simple PRs that increase the compatibility would be welcome, but we don't want the adapter to get too complicated. Ideally, folks will port their command files instead.

@weitzman weitzman closed this Jun 2, 2023
@jonathan1055
Copy link
Contributor Author

Thanks for the info. I have two questions though
(a) If I had not raised this issue, how would I know that drush.services.yml is deprecated in drush12? Maybe I missed some announcement? Usually when deprecated things are used we get messages. I just got a test failure, which was fortunate.
(b) Where would I find info on how to replace the functionality currently in drush.services.yml? I looked in WootStaticFactoryCommands for the example you gave, but it's not clear how I would go about making the changes

@weitzman
Copy link
Member

weitzman commented Jun 2, 2023

a) We will be sure to put this into the Drush 12.0.0 release notes. I think a debug message noting use of the deprecated API would be useful. That would go somewhere in https://github.com/drush-ops/drush/blob/12.x/src/Runtime/LegacyServiceInstantiator.php
b) https://www.drush.org/12.x/commands/. Add a create() method and constructor to the commandfile. Remove drush.services.yml

@jonathan1055
Copy link
Contributor Author

Thank you, that's really helpful.

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.

3 participants