MemoryTestRepository::load()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 1
1
<?php declare(strict_types = 1);
2
3
namespace TomCizek\SymfonyProoph\Tests\EventSourcing\FakeImplementations;
4
5
use Prooph\EventSourcing\Aggregate\AggregateRepository;
6
use Prooph\EventStore\TransactionalActionEventEmitterEventStore;
7
use Ramsey\Uuid\UuidInterface;
8
9
class MemoryTestRepository extends AggregateRepository implements MemoryTestRepositoryInterface
10
{
11
	/**
12
	 * @var TransactionalActionEventEmitterEventStore
13
	 */
14
	protected $eventStore;
15
16
	public function save(TestAggregateRoot $testAggregateRoot): void
17
	{
18
		$this->eventStore->beginTransaction();
19
		$this->saveAggregateRoot($testAggregateRoot);
20
		$this->eventStore->commit();
21
	}
22
23
	public function load(UuidInterface $uuid): TestAggregateRoot
24
	{
25
		/** @var TestAggregateRoot $testAggregateRoot */
26
		$testAggregateRoot = $this->getAggregateRoot($uuid->toString());
27
28
		return $testAggregateRoot;
29
	}
30
}
31
32