1 | <?php |
||
11 | final class Repository |
||
12 | { |
||
13 | /** @var $entityClass */ |
||
14 | private $entityClass; |
||
15 | |||
16 | /** @var EventStore $eventStore */ |
||
17 | private $eventStore; |
||
18 | |||
19 | /** |
||
20 | * @param string $class |
||
21 | * @param EventStore $eventStore |
||
22 | */ |
||
23 | private function __construct($class, EventStore $eventStore) |
||
28 | |||
29 | /** |
||
30 | * @param $class |
||
31 | * @param EventStore $eventStore |
||
32 | * @return Repository |
||
33 | */ |
||
34 | public static function createForType($class, EventStore $eventStore) |
||
38 | |||
39 | /** |
||
40 | * @param $key |
||
41 | * @return mixed |
||
42 | */ |
||
43 | public function load($key) |
||
53 | |||
54 | /** |
||
55 | * @param EventSourcedEntity $eventSourcedEntity |
||
56 | * @throws IncorrectEntityClassException |
||
57 | */ |
||
58 | public function save(EventSourcedEntity $eventSourcedEntity) |
||
63 | |||
64 | /** |
||
65 | * @param $class |
||
66 | * @throws IncorrectEntityClassException |
||
67 | */ |
||
68 | private function enforceTypeConstraint($class) |
||
74 | } |
||
75 |