Skip to content

Commit

Permalink
Merge pull request #14 from Jeckel-Lab/feature/upgrade-to-jeckel-lab-…
Browse files Browse the repository at this point in the history
…contract

Update to command bus with contracts
  • Loading branch information
jeckel committed Jun 15, 2020
2 parents 9ef5a27 + e9af47b commit cf7ead9
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 18 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"php": "^7.2",
"symfony/dependency-injection": "^4.3 || ^5.0",
"symfony/http-kernel": "^4.3 || ^5.0",
"jeckel-lab/command-dispatcher": "^0.2",
"jeckel-lab/command-dispatcher": "0.3",
"symfony/config": "^4.3 || ^5.0",
"symfony/doctrine-bridge": "^4.3 || ^5.0",
"doctrine/orm": "^2.7"
Expand Down
2 changes: 1 addition & 1 deletion grumphp.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
parameters:
grumphp:
tasks:
phpcs: null
phpmd:
Expand Down
20 changes: 10 additions & 10 deletions src/CommandBus/Decorator/EntityFlushDecorator.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,38 +10,38 @@
namespace JeckelLab\CommandDispatcherBundle\CommandBus\Decorator;

use Doctrine\ORM\EntityManagerInterface;
use JeckelLab\CommandDispatcher\Command\CommandInterface;
use JeckelLab\CommandDispatcher\CommandBus\CommandBusInterface;
use JeckelLab\CommandDispatcher\CommandResponse\CommandResponseInterface;
use JeckelLab\Contract\Core\CommandDispatcher\Command\Command;
use JeckelLab\Contract\Core\CommandDispatcher\CommandBus\CommandBus;
use JeckelLab\Contract\Core\CommandDispatcher\CommandResponse\CommandResponse;

/**
* Class EntityFlushDecorator
* @package App\Core\CommandBus
*/
class EntityFlushDecorator implements CommandBusInterface
class EntityFlushDecorator implements CommandBus
{
/** @var CommandBusInterface */
/** @var CommandBus */
protected $next;

/** @var EntityManagerInterface */
protected $entityManager;

/**
* EntityFlushDecorator constructor.
* @param CommandBusInterface $next
* @param CommandBus $next
* @param EntityManagerInterface $entityManager
*/
public function __construct(CommandBusInterface $next, EntityManagerInterface $entityManager)
public function __construct(CommandBus $next, EntityManagerInterface $entityManager)
{
$this->next = $next;
$this->entityManager = $entityManager;
}

/**
* @param CommandInterface $command
* @return CommandResponseInterface
* @param Command $command
* @return CommandResponse
*/
public function dispatch(CommandInterface $command): CommandResponseInterface
public function dispatch(Command $command): CommandResponse
{
$response = $this->next->dispatch($command);

Expand Down
7 changes: 1 addition & 6 deletions src/Resources/config/services.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">

<services>
<service id="jeckellab.command.dispatcher" class="JeckelLab\CommandDispatcher\CommandDispatcher" public="false">
<argument type="service" id="jeckellab.command.handler.resolver" />
<argument type="service" id="event_dispatcher" />
</service>
<service id="jeckellab.command.bus.command_dispatcher" class="JeckelLab\CommandDispatcher\CommandBus\CommandDispatcher">
<argument type="service" id="jeckellab.command.handler.resolver" />
</service>
Expand All @@ -29,7 +25,6 @@
<argument type="service" id="service_container" />
</service>

<service id="JeckelLab\CommandDispatcher\CommandDispatcherInterface" alias="jeckellab.command.bus.event_dispatcher_decorator"/>
<service id="JeckelLab\CommandDispatcher\CommandBus\CommandBusInterface" alias="jeckellab.command.bus.event_dispatcher_decorator"/>
<service id="JeckelLab\Contract\Core\CommandDispatcher\CommandBus\CommandBus" alias="jeckellab.command.bus.event_dispatcher_decorator"/>
</services>
</container>

0 comments on commit cf7ead9

Please sign in to comment.