prooph/service-bus

The right way to use Queries?

BonBonSlick opened this issue · 3 comments

I saw examples here https://github.com/prooph/proophessor-do-symfony/blob/master/src/ProophessorDo/Model/Todo/Query/GetTodoById.php

And i cant not find a lot examples. Something like "Best Practices".

If found class
use Prooph\Common\Messaging\Query;
and tried to use it. So my query class like GetTodoById extends Query. But i got error, to fix it have to
redeclare
public $messageName = 'test';
and got error

  -previous: RuntimeException {#2826 ▼
    #message: "QueryBus was not able to identify a Finder for query App\Query\GetTodoById"

So, what is for Query class?
Any documentation updates and more examples??
Like Nuxt.js, it is very young, but there are a lot of examples.
https://github.com/nuxt/nuxt.js/tree/dev/examples

Grate packages, but a lot of people just do not know how to use it, so they have to choose something else. I tried to google samples, and there is nothing.

@BonBonSlick why not take a look at the unit tests?

@prolic because it is not comfortable to search there. Hard to navigate and find what is needed. Difficulties with understandings. A lot of time may be wasted by everyone who search in tests.

Searched in class QueryBusTest extends TestCase, i do not understand it. Query object is not used there.

https://github.com/prooph/service-bus/blob/master/tests/QueryBusTest.php#L44-L72

here $fetchSomething = new FetchSomething(['filter' => 'todo']); is your query object. The message bus allows you to send everything, no specific type is needed.