Enable autoconfiguration

Created on 5 March 2025, 2 months ago

Problem/Motivation

When having hundreds of hook-containing services outside of Hooks, the 'hooks' tag is annoying, given that it can be autoconfigured.

Proposed resolution

Enable autoconfiguration.

Remaining tasks

User interface changes

API changes

Data model changes

📌 Task
Status

Active

Version

1.8

Component

Code

Created by

🇩🇪Germany geek-merlin Freiburg, Germany

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @geek-merlin
  • Merge request !43Enable autoconfiguration #3511292 → (Open) created by geek-merlin
  • Pipeline finished with Success
    2 months ago
    Total: 177s
    #441414
  • 🇩🇪Germany geek-merlin Freiburg, Germany

    This does the trick for me. Tested on a site with hundreds of autoconfigured hook services. Also fixes the related issue.

  • 🇦🇺Australia dpi Perth, Australia

    I'd like to understand the pain point a little better. Why not use put things in Hooks/ namespace and let it all get registered for you? That way you don't need to put anything in any services file?

    Is there a particular reason why that doesnt work for you? Are you using services.yml for some reason?

    Manually tagging services and adding to the yml files is something I consider to be a very rare occurrence, not business-as-usual.

  • 🇦🇺Australia dpi Perth, Australia
  • 🇩🇪Germany geek-merlin Freiburg, Germany

    In a small codebase it is practical to have hooks in a separate autoregistered dir.

    When having custom modules with thousands of highly coupled sub-components, you'd get mad with that.
    In our organisations we have a policy to bundle stuff together in dedicated dirs, including hooks.
    With big codebases, we're doing php-driven autoregistration without services.yml (as core decoupled from sf and is still bikeshedding about that).
    Quite some dev dudes i know with big code bases do it like this.

  • 🇦🇺Australia dpi Perth, Australia

    With big codebases, we're doing php-driven autoregistration without services.yml (as core decoupled from sf and is still bikeshedding about that).
    Quite some dev dudes i know with big code bases do it like this.

    Thanks @geek-merlin, this makes sense, and allows me to approve this issue. I also prefer everything in `src` as a service, relying on private/service removal if unused, per Symfony.

    Perhaps you'd be interested in taking a look at a core ticket I created a year ago: Directory based automatic service creation Needs work to help de-bikeshedding core ;)

    Something needs to be done about the HuxCompilerPass2 name, and I'll do a deeper review. This will happen when I can get to it next, but isnt a high priority. Tests, docs, updates also

Production build 0.71.5 2024