Closed carnau closed 6 years ago
Hello ! It should definitively work with your config.
Please can you check you use the correct bus ? It should be tactician.commandbus.console
according to your config.
Hello, I've checked it and seems fine to me.
App\Infrastructure\Ui\Console\Command\ExampleCommand:
class: App\Infrastructure\Ui\Console\Command\ExampleCommand
arguments:
- '@tactician.commandbus.console'
Ok, did you try to run bin/console debug:tactician
? Can you share the output and the bundle version you use ?
The command shows all the commands in both buses by default. I've added the tag bus to my command; now was removed from the default and it's only available in the console one.
Can't post output but I'll do a PoC as soon as I have free time.
Versions:
league/tactician v1.0.3 A small, flexible command bu...
league/tactician-bundle v1.1.5 Bundle to integrate Tacticia...
league/tactician-container 2.0.0 Tactician integration for an...
league/tactician-doctrine v1.1.1 Plugins for Tactician comman...
league/tactician-logger v0.10.0 Adds PSR-3 logging support t...
Hey @carnau, sorry to hear you're having trouble using this, my apologies :)
I haven't used the bundle for a bit lately, but I think your issue is passing the "default" command_handler middleware to the console bus.
If you take a peek at this part of the README carefully (and I think we need a README PR to make this clearer), we autocreate a custom command_handler middleware for each bus: https://github.com/thephpleague/tactician-bundle#configuring-multiple-command-buses. In that example, the last middleware for the "accounting bus" is different than the last middleware for the default bus above it.
If I look at your example config above, both command buses are getting tactician.middleware.command_handler as their final middleware. That one contains the list of commands that are allowed only for the default bus, NOT for the console bus. So, the final middleware should be tactician.commandbus.console.middleware.command_handler
I'm fairly certain that's the issue, especially since tactician:debug is showing the expected setup.
If that doesn't fix it, I'm a bit stumped and would love to get more details or to double check if the sanitized examples you've posted are still the same as the actual app. :crossed_fingers:
@rosstuck Many thanks for your time, I've just checked it and works as expected with your suggestion. Making it clearer in the docs sounds good π
@tyx Thanks for your help too
Awesome, glad to hear it! If you've got any suggestions on what we could say in the docs to clarify, or would like to send a PR, would love to merge it! :)
On Fri, Oct 12, 2018, 6:30 PM Carlos Arnau Ros notifications@github.com wrote:
@rosstuck https://github.com/rosstuck Many thanks for your time, I've just checked it and works as expected with your suggestion. Making it clearer in the docs sounds good π
@tyx https://github.com/tyx Thanks for your help too
β You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/thephpleague/tactician-bundle/issues/105#issuecomment-429384287, or mute the thread https://github.com/notifications/unsubscribe-auth/AAI9Tixt2hfgM18seP7bagzhQT5wW2S4ks5ukMOYgaJpZM4XV7Bv .
Sure, I have a few days off but will send a PR sometime this week.
Added PR #106 . Closing as there's nothing left here.
I've been following the README but I can get this working. I want to have two command buses that doesn't share the same commands, but seems that adding the bus tag in services.yml is not enough.
Do I have to add any other configuration? Adding the default handler as console works, but I guess that then it will not find the commands of the default bus.
Missing handler for command App\Application\Command\ExampleCommand