1
|
|
|
<?php declare(strict_types=1); |
2
|
|
|
/** |
3
|
|
|
* This file is part of the daikon-cqrs/boot project. |
4
|
|
|
* |
5
|
|
|
* For the full copyright and license information, please view the LICENSE |
6
|
|
|
* file that was distributed with this source code. |
7
|
|
|
*/ |
8
|
|
|
|
9
|
|
|
namespace Daikon\Boot\ReadModel; |
10
|
|
|
|
11
|
|
|
use Daikon\Boot\Service\Provisioner\MessageBusProvisioner; |
|
|
|
|
12
|
|
|
use Daikon\EventSourcing\EventStore\Commit\CommitInterface; |
13
|
|
|
use Daikon\Interop\Assertion; |
14
|
|
|
use Daikon\MessageBus\EnvelopeInterface; |
15
|
|
|
use Daikon\MessageBus\MessageBusInterface; |
16
|
|
|
use Daikon\ReadModel\Projector\EventProjectorMap; |
17
|
|
|
use Daikon\ReadModel\Projector\ProjectorInterface; |
18
|
|
|
use Daikon\ReadModel\Projector\ProjectorServiceInterface; |
19
|
|
|
|
20
|
|
|
final class ProjectorService implements ProjectorServiceInterface |
21
|
|
|
{ |
22
|
|
|
private EventProjectorMap $eventProjectorMap; |
23
|
|
|
|
24
|
|
|
private MessageBusInterface $messageBus; |
25
|
|
|
|
26
|
|
|
public function __construct(EventProjectorMap $eventProjectorMap, MessageBusInterface $messageBus) |
27
|
|
|
{ |
28
|
|
|
$this->eventProjectorMap = $eventProjectorMap; |
29
|
|
|
$this->messageBus = $messageBus; |
30
|
|
|
} |
31
|
|
|
|
32
|
|
|
public function handle(EnvelopeInterface $envelope): void |
33
|
|
|
{ |
34
|
|
|
/** @var CommitInterface $commit */ |
35
|
|
|
$commit = $envelope->getMessage(); |
36
|
|
|
Assertion::implementsInterface($commit, CommitInterface::class); |
37
|
|
|
|
38
|
|
|
$metadata = $envelope->getMetadata(); |
39
|
|
|
foreach ($commit->getEventLog() as $event) { |
40
|
|
|
$projectors = $this->eventProjectorMap->findFor($event); |
41
|
|
|
$projectors->map(fn(string $key, ProjectorInterface $projector) => $projector->handle($envelope)); |
42
|
|
|
$this->messageBus->publish($event, MessageBusProvisioner::EVENTS_CHANNEL, $metadata); |
43
|
|
|
} |
44
|
|
|
} |
45
|
|
|
} |
46
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths