Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[DI] AddConsoleCommandPass uses definitions before ResolveChildDefinitionsPass resolves ones #27259

Copy link
Copy link
Closed
@upyx

Description

@upyx
Issue body actions

Hello!
It is probably minor bug but I must say about it.

Symfony version(s) affected: 4.0.0

Description
I use child services as commands. In this case class should be inherited by parent but actually ChildDefinition doesn't inherit anything. It happens because AddConsoleCommandPass is called before
ResolveChildDefinitionsPass

How to reproduce

# config/services.yaml
services:
  # ... defaults and other services
  parent_service:
    abstract: true
    class: App\SomeConfigurableCommand
    attributes:
      # default attributes

  child_service:
    parent: parent_service
    tags:
      - { name: 'console.command', command: 'app:foo' }

Possible Solution
I'm not sure about it.

Additional context
For workaround I've just added class to all children. It is simple but very ugly...

# config/services.yaml
services:
  # ... defaults and other services
  parent_service:
    abstract: true
    class: App\SomeConfigurableCommand
    attributes:
      # default attributes

  child_service_1:
    parent: parent_service
    class: App\SomeConfigurableCommand
    tags:
      - { name: 'console.command', command: 'app:foo' }
  child_service_2:
    parent: parent_service
    class: App\SomeConfigurableCommand
    tags:
      - { name: 'console.command', command: 'app:bar' }

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

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.