Completed
Pull Request — feature/stable-doctrine-module (#518)
by
unknown
23:58 queued 21:46
created

EntityManager::getConnection()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

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