Increased explicitness of service definitions

This commit is contained in:
Gildas Quéméner
2018-03-23 11:48:49 +01:00
parent c48c336ef2
commit 403a1fa4df
7 changed files with 27 additions and 70 deletions
@@ -1,16 +1,19 @@
services:
_defaults:
autowire: true
public: false
Prooph\EventStoreBusBridge\EventPublisher:
arguments:
- '@prooph_service_bus.default_event_bus'
tags:
- { name: 'prooph_event_store.app.plugin' }
- { name: 'prooph_event_store.default.plugin' }
# Uncomment these lines if your event store support transaction
# The app.event_store.default service must be configured with a
# Prooph\EventStore\TransactionalEventStore instance in order to user the following plugin.
# Read more: http://docs.getprooph.org/event-store/implementations/pdo_event_store/variants.html#3-2-1-2
#
# Prooph\EventStore\TransactionalEventStore: '@Prooph\EventStore\EventStore'
#
# Prooph\EventStoreBusBridge\TransactionManager:
# arguments:
# - '@app.event_store.default'
# tags:
# - { name: 'prooph_service_bus.app_command_bus.plugin' }
# - { name: 'prooph_service_bus.default_command_bus.plugin' }
@@ -1,11 +1,14 @@
prooph_event_store:
stores:
app:
event_store: 'Prooph\EventStore\EventStore'
default:
event_store: 'app.event_store.default'
# repositories:
# App\EventSourcing\TodoRepository:
# aggregate_type: App\EventSourcing\Todo
# aggregate_translator: Prooph\EventSourcing\EventStoreIntegration\AggregateTranslator
services:
Prooph\Common\Messaging\MessageFactory: '@prooph_event_store.message_factory'
_defaults:
public: false
Prooph\EventSourcing\EventStoreIntegration\AggregateTranslator: ~
@@ -1,8 +0,0 @@
prooph_event_store:
stores:
app:
event_store: 'Prooph\EventStore\EventStore'
# repositories:
# App\EventSourcing\TodoRepository:
# aggregate_type: App\EventSourcing\Todo
# aggregate_translator: Prooph\EventSourcing\EventStoreIntegration\AggregateTranslator
@@ -1,9 +0,0 @@
{
"bundles": {
"Prooph\\Bundle\\EventStore\\ProophEventStoreBundle": ["all"]
},
"copy-from-recipe": {
"config/": "%CONFIG_DIR%/",
"src/": "%SRC_DIR%/"
}
}
@@ -1,29 +0,0 @@
<?php
declare(strict_types=1);
namespace App\Command;
use Prooph\EventStore\Stream;
use Prooph\EventStore\StreamName;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
class CreateEventStreamCommand extends ContainerAwareCommand
{
protected function configure()
{
$this->setName('event-store:event-stream:create')
->setDescription('Create event_stream.')
->setHelp('This command creates the event_stream');
}
protected function execute(InputInterface $input, OutputInterface $output)
{
$eventStore = $this->getContainer()->get('prooph_event_store.app');
$eventStore->create(new Stream(new StreamName('event_stream'), new \ArrayIterator([])));
$output->writeln('<info>Event stream was created successfully.</info>');
}
}
@@ -1,22 +1,20 @@
services:
_defaults:
autowire: true
public: false
Prooph\EventStore\EventStore: '@Prooph\EventStore\Pdo\MySqlEventStore'
Prooph\EventStore\Pdo\PersistenceStrategy: '@Prooph\EventStore\Pdo\PersistenceStrategy\MySqlSingleStreamStrategy'
app.event_store.default:
class: Prooph\EventStore\Pdo\MySqlEventStore
arguments:
- '@prooph_event_store.message_factory'
- '@app.event_store.pdo_connection.mysql'
- '@app.event_store.mysql.persistence_strategy'
PDO:
app.event_store.pdo_connection.mysql:
class: \PDO
arguments:
- 'mysql:host=%env(MYSQL_HOST)%;dbname=%env(MYSQL_DBNAME)%'
- '%env(MYSQL_USER)%'
- '%env(MYSQL_PASSWORD)%'
Prooph\EventStore\Pdo\PersistenceStrategy\MySqlSingleStreamStrategy:
app.event_store.mysql.persistence_strategy:
class: Prooph\EventStore\Pdo\PersistenceStrategy\MySqlSingleStreamStrategy
Prooph\EventStore\Pdo\MySqlEventStore:
class: Prooph\EventStore\Pdo\MySqlEventStore
Prooph\EventSourcing\EventStoreIntegration\AggregateTranslator: ~
@@ -1,12 +1,11 @@
prooph_service_bus:
command_buses:
app_command_bus: ~
default_command_bus: ~
event_buses:
app_event_bus: ~
default_event_bus: ~
services:
_defaults:
autowire: true
public: false
Prooph\ServiceBus\CommandBus: '@prooph_service_bus.app_command_bus'
Prooph\ServiceBus\EventBus: '@prooph_service_bus.app_event_bus'
Prooph\ServiceBus\CommandBus: '@prooph_service_bus.default_command_bus'