Jump to content

Edit History

rpommier

rpommier


Add symfony doc source

My modules/mymodule/config/services.yaml began with:

services:
    _defaults:
        autowire: true

    MyModule\Command\MyCommand:
        class: MyModule\Command\MyCommand
        tags: [ 'console.command' ]

Now, by adding the bind element, that seems work as I want:

services:
    _defaults:
        autowire: true
        bind:
            Psr\Log\LoggerInterface: '@monolog.logger.console'

    MyModule\Command\MyCommand:
        class: MyModule\Command\MyCommand
        tags: [ 'console.command' ]

Source: https://symfony.com/doc/3.4/service_container.html#binding-arguments-by-name-or-type

rpommier

rpommier

My modules/mymodule/config/services.yaml began with:

services:
    _defaults:
        autowire: true

    MyModule\Command\MyCommand:
        class: MyModule\Command\MyCommand
        tags: [ 'console.command' ]

Now, by adding the bind element, that seems work as I want:

services:
    _defaults:
        autowire: true
        bind:
            Psr\Log\LoggerInterface: '@monolog.logger.console'

    MyModule\Command\MyCommand:
        class: MyModule\Command\MyCommand
        tags: [ 'console.command' ]

 

rpommier

rpommier

My `modules/mymodule/config/services.yaml` began with:

services:
    _defaults:
        autowire: true

    MyModule\Command\MyCommand:
        class: MyModule\Command\MyCommand
        tags: [ 'console.command' ]

Now, by adding the `bind` element, that seems work as I want:

services:
    _defaults:
        autowire: true
        bind:
            Psr\Log\LoggerInterface: '@monolog.logger.console'

    MyModule\Command\MyCommand:
        class: MyModule\Command\MyCommand
        tags: [ 'console.command' ]

 

×
×
  • Create New...