SimpleBus / docs

[READ ONLY] Documentation for the SimpleBus organisation
http://docs.simplebus.io/
4 stars 16 forks source link

Explain Autowiring #44

Closed ruudk closed 6 years ago

ruudk commented 6 years ago

https://github.com/SimpleBus/AsynchronousBundle/pull/15 https://github.com/SimpleBus/SymfonyBridge/pull/52

kbond commented 6 years ago

Am I missing something here? I had to add the following aliases to my config for this to work:

services:
    SimpleBus\SymfonyBridge\Bus\CommandBus: '@command_bus'
    SimpleBus\SymfonyBridge\Bus\EventBus: '@event_bus'
cmodijk commented 6 years ago

@ruudk Do you know why @kbond needs to at these service aliases?

ruudk commented 6 years ago

Hmm, is the Symfony Bridge enabled in the kernel?

kbond commented 6 years ago

Yes, from what I can see, https://github.com/SimpleBus/SymfonyBridge/pull/52 doesn't actually enable these classes to be autowired. These aliases still need to be added. Does it work for you?

ruudk commented 6 years ago

'command_bus' is simple an alias of 'simplebus.command_bus'. So it should just work.

What version of symfony are you using?

What happens when you do

$this->get(CommandBus::class)
kbond commented 6 years ago

I am using 3.4@RC2. That gives me the following error:

...references class "SimpleBus\SymfonyBridge\Bus\CommandBus" but no such service exists. You should maybe alias this class to the existing "simple_bus.command_bus" service.

I'm not sure how it is working for you.

ruudk commented 6 years ago

@kbond You are right. I'm sorry, I totally missed this. I will fix this the proper way in SymfonyBridge :v: /cc @cmodijk