Skip to content

Latest commit

 

History

History
23 lines (16 loc) · 684 Bytes

query_bus.md

File metadata and controls

23 lines (16 loc) · 684 Bytes

Query bus

The query bus is designed to handle querys. It's a publish–subscribe pattern.

You can use HandlerLocatedQueryBus. This bus use QueryHandlerLocator for search the handler for specific query.

use GpsLab\Component\Query\Bus\HandlerLocatedQueryBus;
use GpsLab\Component\Query\Handler\Locator\DirectBindingQueryHandlerLocator;

$locator = new DirectBindingQueryHandlerLocator();
$bus = new HandlerLocatedQueryBus($locator);

$query = new ContactByIdentity();
$query->id = $contact_id;

$data = $bus->handle($query);

You can create custom bus implementing the interface QueryBus.