Closed
Description
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' }