Closed (fixed)
Project:
Index Now
Version:
3.1.x-dev
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
2 Feb 2026 at 12:14 UTC
Updated:
7 Feb 2026 at 17:39 UTC
Jump to comment: Most recent
The config gets in the constructor leads to a circular dependency injection error. This is a known anti pattern. Listed as such in: https://mglaman.dev/blog/dependency-injection-anti-patterns-drupal
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
webflo commentedThanks!
Comment #4
macsim commentedHi webflo,
If this is a bug report, please complete the "steps to reproduce" section, I would be glad to know how you met that "circular dependency injection error".
I think it's more a "might lead to a circular dependency injection error" than a 100% error and would therefore categorize the issue as a task rather than a bug report.
I'll update the tests in order to make the MR mergeable.
It's not the only class where I used to do things in the constructor ; we would also need to update the following classes:
ModuleSettingsFormIndexNowNodeOperationsTermOperationsComment #5
webflo commented@macsim You are right, its more of a task than a bug. The steps to reproduce are complex. I documented it in #3570992: Avoid config get in constructor. This module has the same issue.
It is related to the index_now.path_processor service and LanguageNegotiationUserAdmin
Comment #6
macsim commentedTests are now validated for
IndexNowKeyManagerNote: Off-topic, I've also added a test to cover the
::generateKey()methodLeaving the NW status unchanged because I also want to update the other files mentioned in my previous comment (and their associated tests)
Comment #7
macsim commentedThe code looks correct, but I blind coded everything.
Need to double-check that everything works.
Comment #8
macsim commentedSorry for the spam
Still needs work on the form kernel tests
Comment #9
macsim commentedNow all constructors are anti-pattern free
Tested the whole module, everything works fine.
Thanks @webflo
Comment #10
macsim commentedComment #12
macsim commented