Skip to content

Commit 1f1ca6d

Browse files
author
codeliner
committed
Initial commit
1 parent ee1d61c commit 1f1ca6d

23 files changed

+938
-0
lines changed

.docheader

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/**
2+
* This file is part of event-engine/php-persistence.
3+
* (c) 2018-%year% prooph software GmbH <contact@prooph.de>
4+
*
5+
* For the full copyright and license information, please view the LICENSE
6+
* file that was distributed with this source code.
7+
*/

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
tests/ export-ignore

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.idea
2+
composer.lock
3+
vendor

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2018-2019 prooph software GmbH
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
# php-persistence
2+
23
Event Engine PHP Persistence Package

composer.json

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
{
2+
"name": "event-engine/php-persistence",
3+
"description": "Event Engine PHP Persistence Package",
4+
"homepage": "https://event-engine.io/",
5+
"license": "MIT",
6+
"authors": [
7+
{
8+
"name": "Alexander Miertsch",
9+
"email": "contact@prooph.de",
10+
"homepage": "http://www.prooph.de"
11+
},
12+
{
13+
"name": "Sandro Keil",
14+
"email": "contact@prooph.de",
15+
"homepage": "http://prooph-software.com/"
16+
}
17+
],
18+
"require": {
19+
"php": "^7.2",
20+
"roave/security-advisories": "dev-master",
21+
"event-engine/php-document-store": "dev-master",
22+
"event-engine/php-event-store": "dev-master",
23+
"ramsey/uuid" : "^3.6"
24+
},
25+
"require-dev": {
26+
"phpunit/phpunit": "^7.0",
27+
"prooph/php-cs-fixer-config": "^0.3",
28+
"satooshi/php-coveralls": "^1.0",
29+
"malukenho/docheader": "^0.1.4"
30+
},
31+
"autoload": {
32+
"psr-4": {
33+
"EventEngine\\Persistence\\": "src/"
34+
}
35+
},
36+
"autoload-dev": {
37+
"psr-4": {
38+
"EventEngineTest\\Persistence\\": "tests/"
39+
}
40+
},
41+
"prefer-stable": true,
42+
"scripts": {
43+
"check": [
44+
"@cs",
45+
"@docheader",
46+
"@test"
47+
],
48+
"docheader": "vendor/bin/docheader check src/ tests/",
49+
"cs": "php-cs-fixer fix -v --diff --dry-run",
50+
"cs-fix": "php-cs-fixer fix -v --diff",
51+
"test": "vendor/bin/phpunit"
52+
}
53+
}

phpunit.xml.dist

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit backupGlobals="false"
3+
backupStaticAttributes="false"
4+
colors="true"
5+
convertErrorsToExceptions="true"
6+
convertNoticesToExceptions="true"
7+
convertWarningsToExceptions="true"
8+
processIsolation="false"
9+
stopOnFailure="false"
10+
bootstrap="vendor/autoload.php"
11+
>
12+
<testsuite name="prooph software Event Engine Test Suite">
13+
<directory>./tests/</directory>
14+
</testsuite>
15+
16+
<filter>
17+
<whitelist>
18+
<directory>./src/</directory>
19+
</whitelist>
20+
</filter>
21+
</phpunit>

src/AggregateStateStore.php

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?php
2+
/**
3+
* This file is part of event-engine/php-persistence.
4+
* (c) 2018-2019 prooph software GmbH <contact@prooph.de>
5+
*
6+
* For the full copyright and license information, please view the LICENSE
7+
* file that was distributed with this source code.
8+
*/
9+
10+
declare(strict_types=1);
11+
12+
namespace EventEngine\Persistence;
13+
14+
use EventEngine\Aggregate\Exception\AggregateNotFound;
15+
16+
interface AggregateStateStore
17+
{
18+
/**
19+
* @param string $aggregateType
20+
* @param string $aggregateId
21+
* @param int|null $expectedVersion
22+
* @return mixed State of the aggregate
23+
* @throws AggregateNotFound
24+
*/
25+
public function loadAggregateState(string $aggregateType, string $aggregateId, int $expectedVersion = null);
26+
}

src/ComposedMultiModelStore.php

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?php
2+
/**
3+
* This file is part of event-engine/php-persistence.
4+
* (c) 2019 prooph software GmbH <contact@prooph.de>
5+
*
6+
* For the full copyright and license information, please view the LICENSE
7+
* file that was distributed with this source code.
8+
*/
9+
10+
declare(strict_types=1);
11+
12+
namespace EventEngine\Persistence;
13+
14+
use EventEngine\DocumentStore\DocumentStore;
15+
use EventEngine\EventStore\EventStore;
16+
17+
final class ComposedMultiModelStore implements MultiModelStore
18+
{
19+
use InnerEventStore, InnerDocumentStore, InnerConnection;
20+
21+
public function __construct(
22+
TransactionalConnection $connection,
23+
EventStore $eventStore,
24+
DocumentStore $documentStore
25+
) {
26+
$this->connection = $connection;
27+
$this->eventStore = $eventStore;
28+
$this->documentStore = $documentStore;
29+
}
30+
}

src/DeletableState.php

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
/**
3+
* This file is part of event-engine/php-persistence.
4+
* (c) 2018-2019 prooph software GmbH <contact@prooph.de>
5+
*
6+
* For the full copyright and license information, please view the LICENSE
7+
* file that was distributed with this source code.
8+
*/
9+
10+
declare(strict_types=1);
11+
12+
namespace EventEngine\Persistence;
13+
14+
/**
15+
* Interface DeletableState
16+
*
17+
* Aggregate state can implement this interface to indicate that AggregateProjector should delete the state in
18+
* the read model.
19+
*
20+
* @package EventEngine\Persistence
21+
*/
22+
interface DeletableState
23+
{
24+
public function deleted(): bool;
25+
}

0 commit comments

Comments
 (0)