Skip to content

Commit 67ac599

Browse files
committed
upgrade
- 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
1 parent 9c4dd67 commit 67ac599

File tree

81 files changed

+883
-315
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+883
-315
lines changed

.docheader

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/**
2+
* This file is part of prooph/event-store-symfony-bundle.
3+
* (c) 2014-%year% Alexander Miertsch <kontakt@codeliner.ws>
4+
* (c) 2015-%year% Sascha-Oliver Prolic <saschaprolic@googlemail.com>
5+
*
6+
* For the full copyright and license information, please view the LICENSE
7+
* file that was distributed with this source code.
8+
*/

.travis.yml

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ env:
1818
before_install:
1919
- mv ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini{,.disabled} || echo "xdebug not available"
2020
- composer self-update
21-
- composer global require --no-progress --no-scripts --no-plugins symfony/flex dev-master
21+
- composer global require --no-progress --no-scripts --no-plugins symfony/flex dev-main
2222

2323
install:
2424
- travis_retry composer update -n --prefer-dist --prefer-stable
@@ -28,23 +28,6 @@ script:
2828

2929
jobs:
3030
include:
31-
- php: 7.1
32-
env: LOWEST SYMFONY_DEPRECATIONS_HELP=weak SYMFONY_REQUIRE="3.4.*"
33-
install:
34-
- composer require --dev lendable/symfony-messenger-polyfill --no-update
35-
- travis_retry composer update -n --prefer-lowest --prefer-stable --prefer-dist
36-
37-
- php: 7.2
38-
install:
39-
- composer require --dev symfony/messenger --no-update
40-
- travis_retry composer update -n --prefer-dist
41-
42-
- php: 7.3
43-
install:
44-
- composer require --dev symfony/messenger --no-update
45-
- travis_retry composer update -n --prefer-dist
46-
47-
4831
# Test against latest Symfony 3.4
4932
- php: 7.4
5033
env: SYMFONY_REQUIRE="3.4.*"
@@ -67,17 +50,18 @@ jobs:
6750
- travis_retry composer update -n --prefer-dist
6851

6952
- stage: Code Quality
70-
env: CODING_STANDARDS
71-
php: 7.4
53+
env: CODING_STANDARDS=1
54+
php: 8.0
7255
install:
7356
- composer require --dev symfony/messenger --no-update
7457
- travis_retry composer update -n --prefer-dist
7558
script:
7659
- ./vendor/bin/php-cs-fixer fix -v --diff --dry-run
77-
- ./vendor/bin/phpstan analyse -c phpstan.neon -l 7 src
60+
- ./vendor/bin/phpstan analyse -c phpstan.neon -l 6 src
7861

7962
- stage: Coverage
80-
php: 7.4
63+
php: 8.0
64+
env: XDEBUG_MODE=coverage
8165
install:
8266
- composer require --dev symfony/messenger --no-update
8367
- travis_retry composer update -n --prefer-dist

LICENSE.md

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,28 @@
1-
New BSD License
2-
===============
3-
4-
Copyright (c) 2016 - 2019, Alexander Miertsch <kontakt@codeliner.ws> and Sascha-Oliver Prolic <saschaprolic@googlemail.com>
1+
Copyright (c) 2014-2021, Alexander Miertsch
2+
Copyright (c) 2015-2021, Sascha-Oliver Prolic
53
All rights reserved.
64

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

10-
* Redistributions of source code must retain the above copyright notice,
11-
this list of conditions and the following disclaimer.
8+
* Redistributions of source code must retain the above copyright notice, this
9+
list of conditions and the following disclaimer.
10+
1211
* Redistributions in binary form must reproduce the above copyright notice,
1312
this list of conditions and the following disclaimer in the documentation
1413
and/or other materials provided with the distribution.
15-
* Neither the names of the copyright holders nor the names of its
16-
contributors may be used to endorse or promote products derived from this
17-
software without specific prior written permission.
14+
15+
* Neither the name of prooph nor the names of its
16+
contributors may be used to endorse or promote products derived from
17+
this software without specific prior written permission.
1818

1919
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
2020
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21-
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22-
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
23-
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24-
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25-
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26-
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27-
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28-
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29-
POSSIBILITY OF SUCH DAMAGE.
21+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ Run `composer require prooph/event-store-symfony-bundle` to install prooph event
1212

1313
> See [Symfony Proophessor-Do demo application](https://github.com/prooph/proophessor-do-symfony) for an example.
1414
15+
## Migration from 0.8.0 to 0.9.0
16+
17+
After 0.8.0 `prooph/event-sourcing` dependency was dropped. If you implemented your business logic based on that component
18+
you can still run your application although, you will have to do some additional work.
19+
Please follow [migration instructions](doc/migrating_from_0.8.0.md) for that.
20+
1521
## Documentation
1622
For the latest online documentation visit [http://getprooph.org/](http://getprooph.org/ "Latest documentation").
1723

composer.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
}
5252
},
5353
"require": {
54-
"php": "^7.1",
54+
"php": "^7.4|^8.0",
5555
"ext-pdo": "*",
5656
"ext-json": "*",
5757
"symfony/config": "^3.4 || ^4.4 || ^5.0",
@@ -63,12 +63,12 @@
6363
},
6464
"require-dev": {
6565
"prooph/pdo-event-store": "^1.12",
66-
"phpunit/phpunit": "^7 || ^8",
66+
"phpunit/phpunit": "^8 || ^9",
6767
"symfony/yaml" : "^3.4 || ^4.4 || ^5.0",
6868
"bookdown/bookdown": "1.x-dev as 1.0.0",
6969
"prooph/bookdown-template": "^0.2.3",
7070
"friendsofphp/php-cs-fixer": "^2.8.1",
71-
"prooph/php-cs-fixer-config": "^0.2.1",
71+
"prooph/php-cs-fixer-config": "^0.4",
7272
"matthiasnoback/symfony-dependency-injection-test": "^3.1 || ^4.1",
7373
"phpstan/phpstan": "^0.12"
7474
},
@@ -89,7 +89,8 @@
8989
"cs-fix": "php-cs-fixer fix -v --diff",
9090
"test": "phpunit --no-coverage",
9191
"test-coverage": "phpunit",
92-
"docs": "bookdown doc/bookdown.json"
92+
"docs": "bookdown doc/bookdown.json",
93+
"phpstan": "phpstan analyse -c phpstan.neon -l 6 src"
9394
},
9495
"archive": {
9596
"exclude": [

doc/bookdown.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@
66
{"event_store": "event_store.md"},
77
{"projection_manager": "projection_manager.md"},
88
{"configuration_reference": "configuration_reference.md"},
9-
{"messenger": "messenger.md"}
9+
{"messenger": "messenger.md"},
10+
{"migrating_from_0.8.0": "migrating_from_0.8.0.md"}
1011
],
1112
"target": "./html",
1213
"tocDepth": 2,
1314
"template": "../vendor/prooph/bookdown-template/templates/main.php",
14-
"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>"
15+
"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>"
1516
}

doc/configuration_reference.md

Lines changed: 18 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,9 @@ prooph_event_store:
77
event_emitter: Prooph\Common\Event\ProophActionEventEmitter
88
wrap_action_event_emitter: true
99
event_store: Prooph\EventStore\Pdo\MysqlEventStore
10-
repositories:
11-
todo_list:
12-
repository_class: Prooph\ProophessorDo\Infrastructure\Repository\EventStoreUserCollection
13-
aggregate_type: Prooph\ProophessorDo\Model\User\User
14-
aggregate_translator: prooph_event_sourcing.aggregate_translator
15-
snapshot_store: ~
16-
stream_name: ~
17-
one_stream_per_aggregate: false
1810
projection_managers:
1911
main_manager:
20-
event_store: Prooph\EventStore\Pdo\MysqlEventStore
12+
event_store: 'prooph_event_store.acme_store'
2113
connection: 'doctrine.pdo.connection'
2214
event_streams_table: 'event_streams'
2315
projection_table: 'projections'
@@ -52,39 +44,42 @@ The default value should be fine for most use cases.
5244
Should the given event store be decorated by an ActionEventEmitterEventStore?
5345
In most cases you should keep this with the default value `true`.
5446

55-
5647
### event_store
5748

5849
*Required*
5950

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

63-
#### stream_name
64-
65-
*Optional*
66-
67-
You can pass a string as custom stream name if you want.
68-
69-
#### one_stream_per_aggregate
70-
71-
*Optional*
72-
73-
Should the repository create an own single stream for each aggregate?
74-
See section *Using different Stream Strategies* for of [the event store section](./event_store.md) of this documentation for further details.
75-
7654
## projection_managers
7755

7856
### event_store
7957

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

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

8469
### projection_table
8570

71+
Self-explanatory. Table name in which Projection Manager will hold current information about managed projections.
72+
8673
### projections
8774

75+
Collection of projections managed by Projection Manager.
76+
8877
#### read_model
8978

79+
ID of a service that implements `Prooph\EventStore\Projection\ReadModel` interface for persistent projections.
80+
ReadModel is used to update data in (you guessed) read-only data storage.
81+
9082
#### projection
83+
84+
ID of a service that implements `Prooph\Bundle\EventStore\Projection\Projection` or `Prooph\Bundle\EventStore\Projection\ReadModelProjection`
85+
for persistent projections. Implementation should configure how events of a certain Aggregate will be handled while running projection.

doc/event_store.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ services:
4343
> to learn about the different strategies.
4444
> See below for further information within this bundle.
4545
46-
Do not be confused about the fact that the we defined a service with a class called event store – we are not done yet.
46+
Do not be confused about the fact that we defined a service with a class called event store – we are not done yet.
4747
But we are ready to configure the event store:
4848
4949
```yaml

doc/migrating_from_0.8.0.md

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
# Migrating from 0.8.0
2+
3+
Due to [the future of prooph components](https://www.sasaprolic.com/2018/08/the-future-of-prooph-components.html)
4+
and [ES/Service-Bus discussion](https://github.com/prooph/event-sourcing/issues/90)
5+
, `prooph/event-sourcing` dependency was dropped for this bundle after `0.8.0`. You can still use it, but additional work
6+
must be done after upgrading this bundle to `0.9.0` or further.
7+
8+
## Explicit installation of event sourcing component
9+
10+
`prooph/event-sourcing` is still available and can be installed by single composer command
11+
12+
```console
13+
$ composer install prooph/event-sourcing
14+
```
15+
16+
## Explicit definition of aggregate repositories
17+
18+
Aggregate repositories were part of `prooph/event-sourcing` and without it, bundle will no longer register repositories
19+
as a services. You have to configure those by yourself. Let's consider following configuration
20+
21+
```yaml
22+
prooph_event_store:
23+
stores:
24+
default:
25+
event_store: 'Prooph\EventStore\EventStore'
26+
repositories:
27+
some_aggregate:
28+
repository_class: App\Infrastructure\Persistence\SomeAggregateRepository
29+
aggregate_type: App\Domain\Model\SomeAggregate
30+
aggregate_translator: Prooph\EventSourcing\EventStoreIntegration\AggregateTranslator
31+
stream_name: 'some_aggregate_stream'
32+
33+
projection_managers:
34+
default_projection_manager:
35+
event_store: '@prooph_event_store.default'
36+
connection: '@app.event_store.pdo'
37+
projections:
38+
some_projection:
39+
read_model: App\Infrastructure\Projection\SomeProjectionReadModel
40+
projection: App\Infrastructure\Projection\SomeProjection
41+
42+
services:
43+
Prooph\EventSourcing\EventStoreIntegration\AggregateTranslator: ~
44+
45+
Prooph\EventStore\EventStore:
46+
class: 'Prooph\EventStore\Pdo\PostgresEventStore'
47+
arguments:
48+
- '@prooph_event_store.message_factory'
49+
- '@app.event_store.pdo'
50+
- '@app.event_store.persistence_strategy'
51+
52+
app.event_store.pdo:
53+
class: \PDO
54+
55+
app.event_store.mysql.persistence_strategy:
56+
class: Prooph\EventStore\Pdo\PersistenceStrategy\PostgresSimpleStreamStrategy
57+
```
58+
59+
As you can see, there is a single EventStore configured with one repository. To make application work the same you have
60+
to
61+
62+
1. define a service of class `Prooph\EventSourcing\Aggregate\AggregateType` and `Prooph\EventStore\StreamName` for each
63+
aggregate, so it can be injected into repository
64+
2. define each repository as a service
65+
66+
Your configuration should be transformed as follows
67+
68+
```yaml
69+
prooph_event_store:
70+
stores:
71+
default:
72+
event_store: 'Prooph\EventStore\EventStore'
73+
74+
projection_managers:
75+
default_projection_manager:
76+
event_store: '@prooph_event_store.default'
77+
connection: '@app.event_store.pdo'
78+
projections:
79+
some_projection:
80+
read_model: App\Infrastructure\Projection\SomeProjectionReadModel
81+
projection: App\Infrastructure\Projection\SomeProjection
82+
83+
services:
84+
Prooph\EventSourcing\EventStoreIntegration\AggregateTranslator: ~
85+
86+
Prooph\EventStore\EventStore:
87+
class: 'Prooph\EventStore\Pdo\PostgresEventStore'
88+
arguments:
89+
- '@prooph_event_store.message_factory'
90+
- '@app.event_store.pdo'
91+
- '@app.event_store.persistence_strategy'
92+
93+
app.some_aggregate.type:
94+
class: 'Prooph\EventSourcing\Aggregate\AggregateType'
95+
factory: [ 'Prooph\EventSourcing\Aggregate\AggregateType', 'fromAggregateRootClass' ]
96+
arguments:
97+
- 'App\Domain\Model\SomeAggregate'
98+
99+
app.some_aggregate.stream:
100+
class: 'Prooph\EventStore\StreamName'
101+
arguments:
102+
- 'some_aggregate_stream'
103+
104+
App\Infrastructure\Persistence\SomeAggregateRepository:
105+
arguments:
106+
$eventStore: '@prooph_event_store.default'
107+
$aggregateType: '@app.some_aggregate.type'
108+
$aggregateTranslator: Prooph\EventSourcing\EventStoreIntegration\AggregateTranslator
109+
$streamName: '@app.some_aggregate.stream'
110+
$oneStreamPerAggregate: true
111+
112+
app.event_store.pdo:
113+
class: \PDO
114+
115+
app.event_store.mysql.persistence_strategy:
116+
class: Prooph\EventStore\Pdo\PersistenceStrategy\PostgresSimpleStreamStrategy
117+
```
118+
119+
A bit overloading, but writing Event Sourcing component by yourself is quite easy (it takes few classes to work).

0 commit comments

Comments
 (0)