[Chapter7] Improvements
This commit is contained in:
@@ -76,32 +76,33 @@ services:
|
||||
- { name: messenger.message_handler, bus: query.bus }
|
||||
|
||||
# CHAPTER 6
|
||||
Cheeper\Chapter6\Infrastructure\:
|
||||
resource: '../src/Cheeper/Chapter6/Infrastructure/**/*.php'
|
||||
|
||||
Cheeper\Chapter6\:
|
||||
resource: '../src/Cheeper/Chapter6/*'
|
||||
|
||||
Cheeper\Chapter6\Application\Author\Projection\CountFollowersProjectionHandler: ~
|
||||
|
||||
Cheeper\Chapter6\Application\Author\Command\WithDomainEvents\FollowCommandHandler:
|
||||
chapter6_command_handlers:
|
||||
namespace: Cheeper\Chapter6\Application\
|
||||
resource: '../src/Cheeper/Chapter6/Application/**/*CommandHandler.php'
|
||||
tags:
|
||||
- { name: messenger.message_handler, bus: command.bus }
|
||||
class: 'Cheeper\Chapter6\Application\Author\Command\WithDomainEvents\FollowCommandHandler'
|
||||
|
||||
Cheeper\Chapter6\Infrastructure\Application\Author\Projection\SymfonyCountFollowersProjector:
|
||||
tags:
|
||||
- { name: messenger.message_handler, bus: command.bus }
|
||||
arguments:
|
||||
- '@Cheeper\Chapter6\Application\Author\Projection\CountFollowersProjectionHandler'
|
||||
# Cheeper\Chapter6\Infrastructure\:
|
||||
# resource: '../src/Cheeper/Chapter6/Infrastructure/**/*.php'
|
||||
#
|
||||
# Cheeper\Chapter6\:
|
||||
# resource: '../src/Cheeper/Chapter6/*'
|
||||
#
|
||||
# Cheeper\Chapter6\Application\Author\Command\WithDomainEvents\FollowCommandHandler:
|
||||
# tags:
|
||||
# - { name: messenger.message_handler, bus: command.bus }
|
||||
# class: 'Cheeper\Chapter6\Application\Author\Command\WithDomainEvents\FollowCommandHandler'
|
||||
#
|
||||
# Cheeper\Chapter6\Infrastructure\Application\Author\Projection\SymfonyAuthorFollowedEventHandler:
|
||||
# tags:
|
||||
# - { name: messenger.message_handler, bus: event.bus }
|
||||
# class: 'Cheeper\Chapter6\Infrastructure\Application\Author\Projection\SymfonyAuthorFollowedEventHandler'
|
||||
|
||||
Cheeper\Chapter6\Infrastructure\Application\Author\Projection\SymfonyAuthorFollowedHandler:
|
||||
tags:
|
||||
- { name: messenger.message_handler, bus: event.bus }
|
||||
class: 'Cheeper\Chapter6\Infrastructure\Application\Author\Projection\SymfonyAuthorFollowedHandler'
|
||||
# Cheeper\Chapter6\Application\EventBus:
|
||||
# class: 'Cheeper\Chapter6\Infrastructure\Application\SymfonyEventBus'
|
||||
|
||||
Cheeper\Chapter6\Application\EventBus:
|
||||
class: 'Cheeper\Chapter6\Infrastructure\Application\SymfonyEventBus'
|
||||
# Cheeper\Chapter6\Application\ProjectionBus:
|
||||
# class: 'Cheeper\Chapter6\Infrastructure\Application\SymfonyProjectionBus'
|
||||
|
||||
# CHAPTER 7
|
||||
Cheeper\Chapter7\:
|
||||
@@ -157,8 +158,4 @@ services:
|
||||
- name: "doctrine.orm.entity_listener"
|
||||
event: "postPersist"
|
||||
entity: 'App\Entity\User'
|
||||
|
||||
Elasticsearch\Client:
|
||||
factory: [ 'Elasticsearch\ClientBuilder', fromConfig ]
|
||||
arguments: [ '%elasticsearch_config%' ]
|
||||
#end-ignore
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Cheeper\Chapter6\Infrastructure\Application;
|
||||
|
||||
use Cheeper\Chapter6\Application\Projection;
|
||||
use Cheeper\Chapter6\Application\ProjectionBus;
|
||||
use Symfony\Component\Messenger\HandleTrait;
|
||||
use Symfony\Component\Messenger\MessageBusInterface;
|
||||
|
||||
//snippet symfony-projection-bus
|
||||
final class SymfonyProjectionBus implements ProjectionBus
|
||||
{
|
||||
use HandleTrait;
|
||||
|
||||
public function __construct(MessageBusInterface $projectionBus)
|
||||
{
|
||||
$this->messageBus = $projectionBus;
|
||||
}
|
||||
|
||||
public function project(Projection $projection): void
|
||||
{
|
||||
$this->messageBus->dispatch($projection);
|
||||
}
|
||||
}
|
||||
//end-snippet
|
||||
Reference in New Issue
Block a user