-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bf3fb0e
commit 0555ca2
Showing
6 changed files
with
81 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Model\Travel\Commands\Command; | ||
|
||
/** @see ReverseTravelHandler */ | ||
final class ReverseTravel | ||
{ | ||
public function __construct(private int $commandId, private int $travelId) | ||
{ | ||
} | ||
|
||
public function getCommandId(): int | ||
{ | ||
return $this->commandId; | ||
} | ||
|
||
public function getTravelId(): int | ||
{ | ||
return $this->travelId; | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
app/model/Travel/Handlers/Command/ReverseTravelHandler.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Model\Travel\Handlers\Command; | ||
|
||
use Model\Travel\Commands\Command\ReverseTravel; | ||
use Model\Travel\Repositories\ICommandRepository; | ||
|
||
final class ReverseTravelHandler | ||
{ | ||
public function __construct(private ICommandRepository $commands) | ||
{ | ||
} | ||
|
||
public function __invoke(ReverseTravel $command): void | ||
{ | ||
$travelCommand = $this->commands->find($command->getCommandId()); | ||
|
||
$travelCommand->reverseTravel($command->getTravelId()); | ||
|
||
$this->commands->save($travelCommand); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters