Completed
Pull Request — develop (#607)
by Tom
03:12 queued 01:40
created

EntityManager::setConnection()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 6
ccs 0
cts 3
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace DoctrineORMModule\Options;
6
7
use Laminas\Stdlib\AbstractOptions;
8
9
class EntityManager extends AbstractOptions
10
{
11
    /**
12
     * Set the configuration key for the Configuration. Configuration key
13
     * is assembled as "doctrine.configuration.{key}" and pulled from
14
     * service locator.
15
     *
16
     * @var string
17
     */
18
    protected $configuration = 'orm_default';
19
20
    /**
21
     * Set the connection key for the Connection. Connection key
22
     * is assembled as "doctrine.connection.{key}" and pulled from
23
     * service locator.
24
     *
25
     * @var string
26
     */
27
    protected $connection = 'orm_default';
28
29
    /**
30
     * Set the connection key for the EntityResolver, which is
31
     * a service of type {@see \Doctrine\ORM\Tools\ResolveTargetEntityListener}.
32
     * The EntityResolver service name is assembled
33
     * as "doctrine.entity_resolver.{key}"
34
     *
35
     * @var string
36
     */
37
    protected $entityResolver = 'orm_default';
38
39
    public function setConfiguration(string $configuration) : self
40
    {
41
        $this->configuration = $configuration;
42
43
        return $this;
44
    }
45
46
    public function getConfiguration() : string
47
    {
48
        return 'doctrine.configuration.' . $this->configuration;
49
    }
50
51
    public function setConnection(string $connection) : self
52
    {
53
        $this->connection = $connection;
54
55
        return $this;
56
    }
57
58
    /**
59
     * @return self
60
     */
61
    public function getConnection() : string
62
    {
63
        return 'doctrine.connection.' . $this->connection;
64
    }
65
66 1
    public function setEntityResolver(string $entityResolver) : self
67
    {
68 1
        $this->entityResolver = (string) $entityResolver;
69
70 1
        return $this;
71
    }
72
73
    /**
74
     * @return self
75
     */
76 1
    public function getEntityResolver() : string
77
    {
78 1
        return 'doctrine.entity_resolver.' . $this->entityResolver;
79
    }
80
}
81