Completed
Pull Request — master (#10)
by Gabriel
60:20
created

getAddressChangeByUuid()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare( strict_types = 1 );
4
5
namespace WMDE\Fundraising\AddressChangeContext\DataAccess;
6
7
use Doctrine\ORM\EntityManager;
8
use WMDE\Fundraising\AddressChangeContext\Domain\AddressChangeRepository;
9
use WMDE\Fundraising\AddressChangeContext\Domain\Model\AddressChange;
10
11
class DoctrineAddressChangeRepository implements AddressChangeRepository {
12
13
	private $entityManager;
14
15
	public function __construct( EntityManager $entityManager ) {
16
		$this->entityManager = $entityManager;
17
	}
18
19
	public function getAddressChangeByUuid( string $uuid ): ?AddressChange {
20
		return $this->entityManager->getRepository( AddressChange::class )->findOneBy( [ 'identifier.identifier' => $uuid ] );
21
	}
22
23
	public function storeAddressChange( AddressChange $addressChange ): void {
24
		$this->entityManager->persist( $addressChange );
25
		$this->entityManager->flush();
26
	}
27
}