Skip to content

Commit

Permalink
upgrade
Browse files Browse the repository at this point in the history
- adding PHP8 support
- dropping unsupported versions
- upgrading to phpunit v9
- removing dependency for phpunit v7 due its dependency to php7.1
- running tests and code analysis on PHP8
- symfony/flex changed default branch name
  • Loading branch information
unixslayer committed Apr 21, 2021
1 parent 9c4dd67 commit 67ac599
Show file tree
Hide file tree
Showing 81 changed files with 883 additions and 315 deletions.
8 changes: 8 additions & 0 deletions .docheader
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/**
* This file is part of prooph/event-store-symfony-bundle.
* (c) 2014-%year% Alexander Miertsch <[email protected]>
* (c) 2015-%year% Sascha-Oliver Prolic <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
28 changes: 6 additions & 22 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ env:
before_install:
- mv ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini{,.disabled} || echo "xdebug not available"
- composer self-update
- composer global require --no-progress --no-scripts --no-plugins symfony/flex dev-master
- composer global require --no-progress --no-scripts --no-plugins symfony/flex dev-main

install:
- travis_retry composer update -n --prefer-dist --prefer-stable
Expand All @@ -28,23 +28,6 @@ script:

jobs:
include:
- php: 7.1
env: LOWEST SYMFONY_DEPRECATIONS_HELP=weak SYMFONY_REQUIRE="3.4.*"
install:
- composer require --dev lendable/symfony-messenger-polyfill --no-update
- travis_retry composer update -n --prefer-lowest --prefer-stable --prefer-dist

- php: 7.2
install:
- composer require --dev symfony/messenger --no-update
- travis_retry composer update -n --prefer-dist

- php: 7.3
install:
- composer require --dev symfony/messenger --no-update
- travis_retry composer update -n --prefer-dist


# Test against latest Symfony 3.4
- php: 7.4
env: SYMFONY_REQUIRE="3.4.*"
Expand All @@ -67,17 +50,18 @@ jobs:
- travis_retry composer update -n --prefer-dist

- stage: Code Quality
env: CODING_STANDARDS
php: 7.4
env: CODING_STANDARDS=1
php: 8.0
install:
- composer require --dev symfony/messenger --no-update
- travis_retry composer update -n --prefer-dist
script:
- ./vendor/bin/php-cs-fixer fix -v --diff --dry-run
- ./vendor/bin/phpstan analyse -c phpstan.neon -l 7 src
- ./vendor/bin/phpstan analyse -c phpstan.neon -l 6 src

- stage: Coverage
php: 7.4
php: 8.0
env: XDEBUG_MODE=coverage
install:
- composer require --dev symfony/messenger --no-update
- travis_retry composer update -n --prefer-dist
Expand Down
35 changes: 17 additions & 18 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,28 @@
New BSD License
===============

Copyright (c) 2016 - 2019, Alexander Miertsch <[email protected]> and Sascha-Oliver Prolic <[email protected]>
Copyright (c) 2014-2021, Alexander Miertsch
Copyright (c) 2015-2021, Sascha-Oliver Prolic
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the names of the copyright holders nor the names of its
contributors may be used to endorse or promote products derived from this
software without specific prior written permission.

* Neither the name of prooph nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ Run `composer require prooph/event-store-symfony-bundle` to install prooph event

> See [Symfony Proophessor-Do demo application](https://github.com/prooph/proophessor-do-symfony) for an example.
## Migration from 0.8.0 to 0.9.0

After 0.8.0 `prooph/event-sourcing` dependency was dropped. If you implemented your business logic based on that component
you can still run your application although, you will have to do some additional work.
Please follow [migration instructions](doc/migrating_from_0.8.0.md) for that.

## Documentation
For the latest online documentation visit [http://getprooph.org/](http://getprooph.org/ "Latest documentation").

Expand Down
9 changes: 5 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
}
},
"require": {
"php": "^7.1",
"php": "^7.4|^8.0",
"ext-pdo": "*",
"ext-json": "*",
"symfony/config": "^3.4 || ^4.4 || ^5.0",
Expand All @@ -63,12 +63,12 @@
},
"require-dev": {
"prooph/pdo-event-store": "^1.12",
"phpunit/phpunit": "^7 || ^8",
"phpunit/phpunit": "^8 || ^9",
"symfony/yaml" : "^3.4 || ^4.4 || ^5.0",
"bookdown/bookdown": "1.x-dev as 1.0.0",
"prooph/bookdown-template": "^0.2.3",
"friendsofphp/php-cs-fixer": "^2.8.1",
"prooph/php-cs-fixer-config": "^0.2.1",
"prooph/php-cs-fixer-config": "^0.4",
"matthiasnoback/symfony-dependency-injection-test": "^3.1 || ^4.1",
"phpstan/phpstan": "^0.12"
},
Expand All @@ -89,7 +89,8 @@
"cs-fix": "php-cs-fixer fix -v --diff",
"test": "phpunit --no-coverage",
"test-coverage": "phpunit",
"docs": "bookdown doc/bookdown.json"
"docs": "bookdown doc/bookdown.json",
"phpstan": "phpstan analyse -c phpstan.neon -l 6 src"
},
"archive": {
"exclude": [
Expand Down
5 changes: 3 additions & 2 deletions doc/bookdown.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@
{"event_store": "event_store.md"},
{"projection_manager": "projection_manager.md"},
{"configuration_reference": "configuration_reference.md"},
{"messenger": "messenger.md"}
{"messenger": "messenger.md"},
{"migrating_from_0.8.0": "migrating_from_0.8.0.md"}
],
"target": "./html",
"tocDepth": 2,
"template": "../vendor/prooph/bookdown-template/templates/main.php",
"copyright": "Copyright (c) 2016 - 2020 <a href=\"http://getprooph.org/\" title=\"prooph maintainers\">prooph maintainers</a> <br/> Powered by <a href=\"https://github.com/tobiju/bookdown-bootswatch-templates\" title=\"Visit project to generate your own docs\">Bookdown Bootswatch Templates</a>"
"copyright": "Copyright (c) 2016 - 2021 <a href=\"http://getprooph.org/\" title=\"prooph maintainers\">prooph maintainers</a> <br/> Powered by <a href=\"https://github.com/tobiju/bookdown-bootswatch-templates\" title=\"Visit project to generate your own docs\">Bookdown Bootswatch Templates</a>"
}
41 changes: 18 additions & 23 deletions doc/configuration_reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,9 @@ prooph_event_store:
event_emitter: Prooph\Common\Event\ProophActionEventEmitter
wrap_action_event_emitter: true
event_store: Prooph\EventStore\Pdo\MysqlEventStore
repositories:
todo_list:
repository_class: Prooph\ProophessorDo\Infrastructure\Repository\EventStoreUserCollection
aggregate_type: Prooph\ProophessorDo\Model\User\User
aggregate_translator: prooph_event_sourcing.aggregate_translator
snapshot_store: ~
stream_name: ~
one_stream_per_aggregate: false
projection_managers:
main_manager:
event_store: Prooph\EventStore\Pdo\MysqlEventStore
event_store: 'prooph_event_store.acme_store'
connection: 'doctrine.pdo.connection'
event_streams_table: 'event_streams'
projection_table: 'projections'
Expand Down Expand Up @@ -52,39 +44,42 @@ The default value should be fine for most use cases.
Should the given event store be decorated by an ActionEventEmitterEventStore?
In most cases you should keep this with the default value `true`.


### event_store

*Required*

The id of a service whose class implements `Prooph\EventStore\EventStore`.
Please have a look at [the event store section](./event_store.md) of this documentation for further details.

#### stream_name

*Optional*

You can pass a string as custom stream name if you want.

#### one_stream_per_aggregate

*Optional*

Should the repository create an own single stream for each aggregate?
See section *Using different Stream Strategies* for of [the event store section](./event_store.md) of this documentation for further details.

## projection_managers

### event_store

This should be reference of an EventStore which will be injected into ProjectionManager. Be aware, that this shouldn't be
ID of a service that implements `Prooph\EventStore\EventStore`, but service configured in `stores` section, eg. `prooph_event_store.acme_store`.
This will inject proper service which can be configured with additional functions like plugins or enrichers.

### connection

If you are using PDO-based `EventStore`, manager require you to inject the `PDO` instance.
Please have a look at [the projection manager section](./projection_manager.md) of this documentation for further details.

### event_streams_table

### projection_table

Self-explanatory. Table name in which Projection Manager will hold current information about managed projections.

### projections

Collection of projections managed by Projection Manager.

#### read_model

ID of a service that implements `Prooph\EventStore\Projection\ReadModel` interface for persistent projections.
ReadModel is used to update data in (you guessed) read-only data storage.

#### projection

ID of a service that implements `Prooph\Bundle\EventStore\Projection\Projection` or `Prooph\Bundle\EventStore\Projection\ReadModelProjection`
for persistent projections. Implementation should configure how events of a certain Aggregate will be handled while running projection.
2 changes: 1 addition & 1 deletion doc/event_store.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ services:
> to learn about the different strategies.
> See below for further information within this bundle.
Do not be confused about the fact that the we defined a service with a class called event store – we are not done yet.
Do not be confused about the fact that we defined a service with a class called event store – we are not done yet.
But we are ready to configure the event store:
```yaml
Expand Down
119 changes: 119 additions & 0 deletions doc/migrating_from_0.8.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
# Migrating from 0.8.0

Due to [the future of prooph components](https://www.sasaprolic.com/2018/08/the-future-of-prooph-components.html)
and [ES/Service-Bus discussion](https://github.com/prooph/event-sourcing/issues/90)
, `prooph/event-sourcing` dependency was dropped for this bundle after `0.8.0`. You can still use it, but additional work
must be done after upgrading this bundle to `0.9.0` or further.

## Explicit installation of event sourcing component

`prooph/event-sourcing` is still available and can be installed by single composer command

```console
$ composer install prooph/event-sourcing
```

## Explicit definition of aggregate repositories

Aggregate repositories were part of `prooph/event-sourcing` and without it, bundle will no longer register repositories
as a services. You have to configure those by yourself. Let's consider following configuration

```yaml
prooph_event_store:
stores:
default:
event_store: 'Prooph\EventStore\EventStore'
repositories:
some_aggregate:
repository_class: App\Infrastructure\Persistence\SomeAggregateRepository
aggregate_type: App\Domain\Model\SomeAggregate
aggregate_translator: Prooph\EventSourcing\EventStoreIntegration\AggregateTranslator
stream_name: 'some_aggregate_stream'

projection_managers:
default_projection_manager:
event_store: '@prooph_event_store.default'
connection: '@app.event_store.pdo'
projections:
some_projection:
read_model: App\Infrastructure\Projection\SomeProjectionReadModel
projection: App\Infrastructure\Projection\SomeProjection

services:
Prooph\EventSourcing\EventStoreIntegration\AggregateTranslator: ~

Prooph\EventStore\EventStore:
class: 'Prooph\EventStore\Pdo\PostgresEventStore'
arguments:
- '@prooph_event_store.message_factory'
- '@app.event_store.pdo'
- '@app.event_store.persistence_strategy'

app.event_store.pdo:
class: \PDO

app.event_store.mysql.persistence_strategy:
class: Prooph\EventStore\Pdo\PersistenceStrategy\PostgresSimpleStreamStrategy
```
As you can see, there is a single EventStore configured with one repository. To make application work the same you have
to
1. define a service of class `Prooph\EventSourcing\Aggregate\AggregateType` and `Prooph\EventStore\StreamName` for each
aggregate, so it can be injected into repository
2. define each repository as a service

Your configuration should be transformed as follows

```yaml
prooph_event_store:
stores:
default:
event_store: 'Prooph\EventStore\EventStore'
projection_managers:
default_projection_manager:
event_store: '@prooph_event_store.default'
connection: '@app.event_store.pdo'
projections:
some_projection:
read_model: App\Infrastructure\Projection\SomeProjectionReadModel
projection: App\Infrastructure\Projection\SomeProjection
services:
Prooph\EventSourcing\EventStoreIntegration\AggregateTranslator: ~
Prooph\EventStore\EventStore:
class: 'Prooph\EventStore\Pdo\PostgresEventStore'
arguments:
- '@prooph_event_store.message_factory'
- '@app.event_store.pdo'
- '@app.event_store.persistence_strategy'
app.some_aggregate.type:
class: 'Prooph\EventSourcing\Aggregate\AggregateType'
factory: [ 'Prooph\EventSourcing\Aggregate\AggregateType', 'fromAggregateRootClass' ]
arguments:
- 'App\Domain\Model\SomeAggregate'
app.some_aggregate.stream:
class: 'Prooph\EventStore\StreamName'
arguments:
- 'some_aggregate_stream'
App\Infrastructure\Persistence\SomeAggregateRepository:
arguments:
$eventStore: '@prooph_event_store.default'
$aggregateType: '@app.some_aggregate.type'
$aggregateTranslator: Prooph\EventSourcing\EventStoreIntegration\AggregateTranslator
$streamName: '@app.some_aggregate.stream'
$oneStreamPerAggregate: true
app.event_store.pdo:
class: \PDO
app.event_store.mysql.persistence_strategy:
class: Prooph\EventStore\Pdo\PersistenceStrategy\PostgresSimpleStreamStrategy
```

A bit overloading, but writing Event Sourcing component by yourself is quite easy (it takes few classes to work).
Loading

0 comments on commit 67ac599

Please sign in to comment.