Passed
Pull Request — master (#63)
by Mark
37:41 queued 23:57
created

EntityManagerTrait::setUpAttributeEntityManager()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 5
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace GraphQLTests\Doctrine;
6
7
use Doctrine\ORM\EntityManager;
8
use Doctrine\ORM\Tools\Setup;
9
10
/**
11
 * Trait to easily set up a dummy entity manager.
12
 */
13
trait EntityManagerTrait
14
{
15
    /**
16
     * @var EntityManager
17
     */
18
    private $entityManager;
19
20
    private function setUpEntityManager(): void
21
    {
22
        // Create the entity manager
23
        $config = Setup::createAnnotationMetadataConfiguration([__DIR__ . '/Blog/Model'], true, null, null, false);
24
        $conn = ['url' => 'sqlite:///:memory:'];
25
        $this->entityManager = EntityManager::create($conn, $config);
26
    }
27
28
    private function setUpAttributeEntityManager(): void
29
    {
30
        $config = Setup::createAttributeMetadataConfiguration([__DIR__ . '/AttributeBlog/Model'], true);
31
        $conn = ['url' => 'sqlite:///:memory:'];
32
        $this->entityManager = EntityManager::create($conn, $config);
33
    }
34
}
35