Doctrine2PersistenceConfigurator   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 52
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 2
dl 0
loc 52
ccs 12
cts 12
cp 1
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A useConnectionParameters() 0 5 1
A useConnection() 0 5 1
A useOutboxMessagesTableName() 0 5 1
A useOutboxEndpointsTableName() 0 5 1
1
<?php
2
namespace PSB\Persistence\Doctrine2;
3
4
5
use Doctrine\DBAL\Connection;
6
use PSB\Core\Persistence\PersistenceConfigurator;
7
8
class Doctrine2PersistenceConfigurator extends PersistenceConfigurator
9
{
10
    /**
11
     * The connection parameters are the same as described in the Doctrine DBAL documentation
12
     *
13
     * @see http://docs.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html
14
     *
15
     * @param array $connectionParameters
16
     *
17
     * @return Doctrine2PersistenceConfigurator
18
     */
19 1
    public function useConnectionParameters(array $connectionParameters)
20
    {
21 1
        $this->settings->set(Doctrine2KnownSettingsEnum::CONNECTION_PARAMETERS, $connectionParameters);
22 1
        return $this;
23
    }
24
25
    /**
26
     * Instead of the connection parameters one can use an already set up connection object.
27
     *
28
     * @param Connection $dbalConnection
29
     *
30
     * @return Doctrine2PersistenceConfigurator
31
     */
32 1
    public function useConnection(Connection $dbalConnection)
33
    {
34 1
        $this->settings->set(Doctrine2KnownSettingsEnum::CONNECTION, $dbalConnection);
35 1
        return $this;
36
    }
37
38
    /**
39
     * @param string $tableName
40
     *
41
     * @return Doctrine2PersistenceConfigurator
42
     */
43 1
    public function useOutboxMessagesTableName($tableName)
44
    {
45 1
        $this->settings->set(Doctrine2KnownSettingsEnum::OUTBOX_MESSAGES_TABLE_NAME, $tableName);
46 1
        return $this;
47
    }
48
49
    /**
50
     * @param string $tableName
51
     *
52
     * @return Doctrine2PersistenceConfigurator
53
     */
54 1
    public function useOutboxEndpointsTableName($tableName)
55
    {
56 1
        $this->settings->set(Doctrine2KnownSettingsEnum::OUTBOX_ENDPOINTS_TABLE_NAME, $tableName);
57 1
        return $this;
58
    }
59
}
60