Skip to content

[FrameworkBundle] Conflict between generated services ID #41198

@lyrixx

Description

@lyrixx

Symfony version(s) affected: all

Description

Symfony used to namespace all generated ID but it's not the case for some services

And maybe more

How to reproduce

framework:
    http_client:
        scoped_clients:
            github:
                base_uri: http://github.com
    cache:
        pools:
            github: null

With the previous configuration, http_client replaces the cache definition (because http client configuration is processed after cache configuration).

>…goire/dev/labs/symfony/symfony-5.4(master *) bin/console  debug:container github

 // This service is a private alias for the service .debug.github                                                       

Information for Service ".debug.github"
=======================================

 ---------------- -------------------------------------------------- 
  Option           Value                                             
 ---------------- -------------------------------------------------- 
  Service ID       .debug.github                                     
  Class            Symfony\Component\HttpClient\TraceableHttpClient  

And If I change the name of the github http client:

>…goire/dev/labs/symfony/symfony-5.4(master *) bin/console  debug:container github

Information for Service "github"
================================

 An adapter that collects data about all cache calls.

 ---------------- -------------------------------------------------- 
  Option           Value                                             
 ---------------- -------------------------------------------------- 
  Service ID       github                                            
  Class            Symfony\Component\Cache\Adapter\TraceableAdapter  

Possible Solution

We must namespace all services ID based on semantic configuration like we did in the past with messenger, workflow, etc

Additional context

This issue is a bit annoying with a different use case:

Once I declared a github client, I'm no longer able to use bin/console debug:container github to find all services that match github because a github service exists. Yes, I can still use | grep github, but still :)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions