Skip to content

Circular Reference When Using @service_container on autowiring mode #17252

@ad3n

Description

@ad3n
services:
    app.menu:
        class: AppBundle\Menu\Builder
        autowire: true
#        arguments:
#            - '@router'
#            - '@service_container'

Before i comment the arguments, the service is work. After that i try to use auto wiring mode and got error

[Symfony\Component\DependencyInjection\Exception\RuntimeException]                                                          
  Unable to autowire argument of type "Symfony\Component\DependencyInjection\ContainerInterface" for the service "app.menu".

And then i try to add auto wire type

services:
    app.menu:
        class: AppBundle\Menu\Builder
        autowire: true
        autowiring_types: Symfony\Component\DependencyInjection\ContainerInterface
#        arguments:
#            - '@router'
#            - '@service_container'

and i got another error

[Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException]  
  Circular reference detected for service "app.menu", path: "app.menu -> app.menu". 

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

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy