Skip to content
This repository has been archived by the owner on Jul 20, 2020. It is now read-only.

Commit

Permalink
Merge branch 'release/1.0.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
bramdevries committed Mar 15, 2017
2 parents 81ff67e + 518793a commit 23e763b
Show file tree
Hide file tree
Showing 47 changed files with 681 additions and 129 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
vendor/
composer.lock
composer.lock
build
6 changes: 0 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,8 @@ sudo: false
# Setup build matrix
language: php
php:
- 5.6
- 7

env:
matrix:
- PREFER_LOWEST="--prefer-lowest"
- PREFER_LOWEST=""

# Dependencies
before_install:
- composer self-update
Expand Down
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
### 1.0.0

### Changed

- `MethodNameInflector` dependencies are now injected when resolving from the IoC.
- Upgraded to broadway 1.0.0

### Fixed

- `Processor` classes now correctly require you to prefix methods with `process` instead of `project`.
18 changes: 18 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Upgrade

## 0.8.0 -> 1.0.0

### Removal of explicit `MethodNameInflector` dependency on `Projector` and `Processor` classes

We removed the explicit `MethodNameInflector` dependency on `Projector` and `Processor` instances, instead this will be injected when the class is being resolved from the IoC container

```diff
class BookProjector extends Projector
{
- public function __construct(MethodNameInflector $inflector, ReadRepository $readRepository)
+ public function __construct(ReadRepository $readRepository)
{
- parent::__construct($inflector);
$this->readRepository = $readRepository;
}
}
43 changes: 27 additions & 16 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,35 +18,46 @@
}
],
"require": {
"php": ">=5.6.0",
"doctrine/dbal": "^2.5",
"broadway/broadway": "^0.10",
"illuminate/console": "^5.4",
"illuminate/database": "^5.4",
"illuminate/events": "^5.4",
"illuminate/support": "^5.4",
"matthiasnoback/broadway-serialization": "^1.0",
"mattketmo/uuid-2x-bridge": "^1.0"
"php": ">=7",
"doctrine/dbal": "~2.5",
"broadway/broadway": "~1.0.0",
"illuminate/console": "~5.4",
"illuminate/database": "~5.4",
"illuminate/events": "~5.4",
"illuminate/support": "~5.4",
"matthiasnoback/broadway-serialization": "~2.0",
"mattketmo/uuid-2x-bridge": "^1.0",
"broadway/broadway-saga": "^0.2.0",
"broadway/event-store-dbal": "^0.1.0",
"broadway/read-model-elasticsearch": "^0.2.0"
},
"require-dev": {
"elasticsearch/elasticsearch": "^2.1",
"laravel/framework": "^5.4",
"elasticsearch/elasticsearch": "~5",
"laravel/framework": "~5.4",
"fabpot/php-cs-fixer": "2.0.*@dev",
"phpunit/phpunit": "^4.7",
"alcaeus/mongo-php-adapter": "^1.0",
"doctrine/mongodb": "^1.4",
"madewithlove/elasticsearcher": "^0.4.1"
"phpunit/phpunit": "^6.0",
"orchestra/testbench": "~3.0"
},
"autoload": {
"psr-4": {
"Madewithlove\\LaravelCqrsEs\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"Madewithlove\\LaravelCqrsEs\\\\Tests\\": "tests/"
},
"classmap": [
"tests/TestCase.php",
"tests/Stubs/BookWasPurchased.php",
"tests/Stubs/BookWasReturned.php"
]
},
"suggest": {
"madewithlove/tactician-laravel": "Laravel wrapper for a configurable command bus"
},
"scripts": {
"test": ""
"test": "phpunit"
},
"minimum-stability": "dev",
"prefer-stable": true
Expand Down
2 changes: 1 addition & 1 deletion config/broadway.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
'event-store' => [
'driver' => 'dbal',
'dbal' => [
'connection' => 'mysql',
'connection' => env('DB_CONNECTION', 'mysql'),
'table' => 'event_store',
],
],
Expand Down
26 changes: 26 additions & 0 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit bootstrap="vendor/autoload.php"
backupGlobals="false"
backupStaticAttributes="false"
colors="true"
verbose="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false">
<testsuites>
<testsuite name="Madewithlove Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory suffix=".php">src/</directory>
</whitelist>
</filter>
<logging>
<log type="coverage-html" target="build/coverage" charset="UTF-8" yui="true" highlight="true"/>
<log type="coverage-clover" target="build/logs/clover.xml"/>
</logging>
</phpunit>
4 changes: 2 additions & 2 deletions resources/stubs/commandHandler.stub
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

namespace {{namespace}};

use Broadway\CommandHandling\CommandHandlerInterface;
use Broadway\CommandHandling\CommandHandler;
use {{command}} as Command;

class {{class}} implements CommandHandlerInterface
class {{class}} implements CommandHandler
{
/**
* @param Command $command
Expand Down
10 changes: 5 additions & 5 deletions resources/stubs/commandHandlerTest.stub
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

namespace {{namespace}};

use Broadway\CommandHandling\CommandHandlerInterface;
use Broadway\CommandHandling\CommandHandler;
use Broadway\CommandHandling\Testing\CommandHandlerScenarioTestCase;
use Broadway\EventHandling\EventBusInterface;
use Broadway\EventStore\EventStoreInterface;
use Broadway\EventHandling\EventBus;
use Broadway\EventStore\EventStore;
use {{commandHandler}} as CommandHandler;
use {{command}} as Command;

Expand All @@ -17,9 +17,9 @@ class {{class}}Test extends CommandHandlerScenarioTestCase
* @param EventStoreInterface $eventStore
* @param EventBusInterface $eventBus
*
* @return CommandHandlerInterface
* @return CommandHandler
*/
protected function createCommandHandler(EventStoreInterface $eventStore, EventBusInterface $eventBus)
protected function createCommandHandler(EventStore $eventStore, EventBus $eventBus)
{
return new CommandHandler();
}
Expand Down
12 changes: 6 additions & 6 deletions resources/stubs/dbalWriteRepository.stub
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@
namespace {{namespace}};

use {{aggregateClass}};
use Broadway\EventHandling\EventBusInterface;
use Broadway\EventHandling\EventBus;
use Broadway\EventSourcing\AggregateFactory\PublicConstructorAggregateFactory;
use Broadway\EventSourcing\EventSourcingRepository;
use Broadway\EventStore\EventStoreInterface;
use Broadway\EventStore\EventStore;

class DbalWriteRepository extends EventSourcingRepository implements WriteRepository
{
/**
* @param EventStoreInterface $eventStore
* @param EventBusInterface $eventBus
* @param EventStore $eventStore
* @param EventBus $eventBus
*/
public function __construct(
EventStoreInterface $eventStore,
EventBusInterface $eventBus
EventStore $eventStore,
EventBus $eventBus
) {
parent::__construct($eventStore, $eventBus, {{aggregateUpper}}::class, new PublicConstructorAggregateFactory());
}
Expand Down
4 changes: 2 additions & 2 deletions resources/stubs/writeRepository.stub
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
namespace {{namespace}};

use {{aggregateClass}};
use Broadway\Repository\RepositoryInterface;
use Broadway\Repository\Repository;

interface WriteRepository extends RepositoryInterface
interface WriteRepository extends Repository
{
/**
* Loads an aggregate from the given id.
Expand Down
3 changes: 2 additions & 1 deletion src/ContextServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Madewithlove\LaravelCqrsEs;

use Broadway\EventHandling\EventBus;
use Broadway\EventHandling\EventBusInterface;
use Illuminate\Support\ServiceProvider as BaseServiceProvider;
use Madewithlove\LaravelCqrsEs\EventHandling\ReplayingEventBusInterface;
Expand All @@ -24,7 +25,7 @@ abstract class ContextServiceProvider extends BaseServiceProvider
public function boot()
{
/** @var EventBusInterface $eventBus */
$liveEventBus = $this->app->make(EventBusInterface::class);
$liveEventBus = $this->app->make(EventBus::class);
$replayOnlyEventBus = $this->app->make(ReplayingEventBusInterface::class);

// Subscribe Projectors to both live events and replayed events
Expand Down
4 changes: 2 additions & 2 deletions src/EventHandling/ReplayingEventBusInterface.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?php
namespace Madewithlove\LaravelCqrsEs\EventHandling;

use Broadway\EventHandling\EventBusInterface;
use Broadway\EventHandling\EventBus;

/**
* Use this event bus only for replays.
* Only listeners that are interested in replayed events should subscribe to this.
*/
interface ReplayingEventBusInterface extends EventBusInterface
interface ReplayingEventBusInterface extends EventBus
{
}
12 changes: 6 additions & 6 deletions src/EventStore/EventStoreManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

namespace Madewithlove\LaravelCqrsEs\EventStore;

use Broadway\EventStore\DBALEventStore;
use Broadway\EventStore\Dbal\DBALEventStore;
use Broadway\EventStore\InMemoryEventStore;
use Broadway\Serializer\SerializerInterface;
use Broadway\Serializer\Serializer;
use Doctrine\DBAL\DriverManager;
use Illuminate\Support\Manager;

Expand All @@ -30,7 +30,7 @@ protected function createDbalDriver()

$params = $this->app['config']->get("database.connections.{$driver}");
$params['dbname'] = $params['database'];
$params['user'] = $params['username'];
$params['user'] = array_key_exists('username', $params) ? $params['username'] : null;
$params['driver'] = "pdo_$driver";

unset($params['database'], $params['username']);
Expand All @@ -39,8 +39,8 @@ protected function createDbalDriver()

return new DBALEventStore(
$connection,
$this->app->make(SerializerInterface::class),
$this->app->make(SerializerInterface::class),
$this->app->make(Serializer::class),
$this->app->make(Serializer::class),
array_get($config, 'table', 'event_store')
);
}
Expand All @@ -52,4 +52,4 @@ protected function createInmemoryDriver()
{
return new InMemoryEventStore();
}
}
}
17 changes: 8 additions & 9 deletions src/EventStore/ServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@

namespace Madewithlove\LaravelCqrsEs\EventStore;

use Broadway\EventDispatcher\CallableEventDispatcher;
use Broadway\EventDispatcher\EventDispatcher;
use Broadway\EventDispatcher\EventDispatcherInterface;
use Broadway\EventHandling\EventBusInterface;
use Broadway\EventHandling\EventBus;
use Broadway\EventHandling\SimpleEventBus;
use Broadway\EventStore\EventStoreInterface;
use Broadway\EventStore\Management\EventStoreManagementInterface;
use Broadway\EventStore\EventStore;
use Madewithlove\LaravelCqrsEs\EventHandling\ReplayingEventBusInterface;
use Madewithlove\LaravelCqrsEs\EventHandling\SimpleReplayingEventBus;
use Madewithlove\LaravelCqrsEs\EventStore\Console\Replay;
Expand All @@ -32,17 +31,17 @@ public function register()
return (new EventStoreManager($this->app))->driver();
});

$this->app->singleton(EventDispatcherInterface::class, function () {
return new EventDispatcher();
$this->app->singleton(EventDispatcher::class, function () {
return new CallableEventDispatcher();
});
$this->app->singleton(EventBusInterface::class, function () {
$this->app->singleton(EventBus::class, function () {
return new SimpleEventBus();
});
$this->app->singleton(ReplayingEventBusInterface::class, function () {
return new SimpleReplayingEventBus();
});
$this->app->alias('event_store.driver', EventStoreInterface::class);
$this->app->alias('event_store.driver', EventStoreManagementInterface::class);
$this->app->alias('event_store.driver', EventStore::class);
$this->app->alias('event_store.driver', EventStoreManager::class);
}

/**
Expand Down
12 changes: 7 additions & 5 deletions src/EventStore/Services/Replay.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,23 @@
namespace Madewithlove\LaravelCqrsEs\EventStore\Services;

use Broadway\Domain\DomainEventStream;
use Broadway\EventHandling\EventBus;
use Broadway\EventHandling\EventBusInterface;
use Broadway\EventStore\CallableEventVisitor;
use Broadway\EventStore\Management\Criteria;
use Broadway\EventStore\Management\EventStoreManagement;
use Broadway\EventStore\Management\EventStoreManagementInterface;
use Madewithlove\LaravelCqrsEs\EventHandling\ReplayingEventBusInterface;

class Replay
{
/**
* @var EventBusInterface
* @var EventBus
*/
protected $eventBus;

/**
* @var EventStoreManagementInterface
* @var EventStoreManagement
*/
protected $eventManager;

Expand All @@ -32,10 +34,10 @@ class Replay
protected $eventBufferSize = 20;

/**
* @param ReplayingEventBusInterface $eventBus
* @param EventStoreManagementInterface $eventManager
* @param EventBus $eventBus
* @param EventStoreManagement $eventManager
*/
public function __construct(ReplayingEventBusInterface $eventBus, EventStoreManagementInterface $eventManager)
public function __construct(EventBus $eventBus, EventStoreManagement $eventManager)
{
$this->eventBus = $eventBus;
$this->eventManager = $eventManager;
Expand Down
3 changes: 2 additions & 1 deletion src/Identifier/Identifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@

namespace Madewithlove\LaravelCqrsEs\Identifier;

use Broadway\Serializer\Serializable;
use Broadway\Serializer\SerializableInterface;

interface Identifier extends SerializableInterface
interface Identifier extends Serializable
{
/**
* @return static
Expand Down
Loading

0 comments on commit 23e763b

Please sign in to comment.