Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/Domain/Command/Handling.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

namespace Streak\Domain\Command;

use Streak\Domain\AggregateRoot;
use Streak\Domain\Command;
use Streak\Domain\Exception\CommandNotSupported;

Expand All @@ -25,6 +26,12 @@
{
public function handleCommand(Command $command): void
{
if ($command instanceof AggregateRootCommand && $this instanceof AggregateRoot) {
if (false === $this->aggregateRootId()->equals($command->aggregateRootId())) {
throw new CommandNotSupported($command);

Check warning on line 31 in src/Domain/Command/Handling.php

View check run for this annotation

Codecov / codecov/patch

src/Domain/Command/Handling.php#L30-L31

Added lines #L30 - L31 were not covered by tests
}
}

$reflection = new \ReflectionObject($this);

foreach ($reflection->getMethods() as $method) {
Expand Down
7 changes: 7 additions & 0 deletions src/Domain/Query/Handling.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

namespace Streak\Domain\Query;

use Streak\Domain\Event;
use Streak\Domain\Exception\QueryNotSupported;
use Streak\Domain\Query;

Expand All @@ -25,6 +26,12 @@
{
public function handleQuery(Query $query)
{
if ($query instanceof EventListenerQuery && $this instanceof Event\Listener) {
if (false === $this->listenerId()->equals($query->listenerId())) {
throw new QueryNotSupported($query);

Check warning on line 31 in src/Domain/Query/Handling.php

View check run for this annotation

Codecov / codecov/patch

src/Domain/Query/Handling.php#L30-L31

Added lines #L30 - L31 were not covered by tests
}
}

$reflection = new \ReflectionObject($this);

foreach ($reflection->getMethods() as $method) {
Expand Down