Completed
Pull Request — 2.10 (#3834)
by Máté
12:16
created

SchemaIndexDefinitionEventArgs   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 79
Duplicated Lines 0 %

Test Coverage

Coverage 23.33%

Importance

Changes 0
Metric Value
wmc 7
eloc 15
dl 0
loc 79
ccs 7
cts 30
cp 0.2333
rs 10
c 0
b 0
f 0

7 Methods

Rating   Name   Duplication   Size   Complexity  
A getTableIndex() 0 3 1
A setIndex() 0 5 1
A getConnection() 0 3 1
A getDatabasePlatform() 0 3 1
A getTable() 0 3 1
A __construct() 0 5 1
A getIndex() 0 3 1
1
<?php
2
3
namespace Doctrine\DBAL\Event;
4
5
use Doctrine\DBAL\Connection;
6
use Doctrine\DBAL\Platforms\AbstractPlatform;
7
use Doctrine\DBAL\Schema\Index;
8
9
/**
10
 * Event Arguments used when the portable index definition is generated inside Doctrine\DBAL\Schema\AbstractSchemaManager.
11
 */
12
class SchemaIndexDefinitionEventArgs extends SchemaEventArgs
13
{
14
    /** @var Index|null */
15
    private $index = null;
16
17
    /**
18
     * Raw index data as fetched from the database.
19
     *
20
     * @var mixed[]
21
     */
22
    private $tableIndex;
23
24
    /** @var string */
25
    private $table;
26
27
    /** @var Connection */
28
    private $connection;
29
30
    /**
31
     * @param mixed[] $tableIndex
32
     * @param string  $table
33
     */
34 26
    public function __construct(array $tableIndex, $table, Connection $connection)
35
    {
36 26
        $this->tableIndex = $tableIndex;
37 26
        $this->table      = $table;
38 26
        $this->connection = $connection;
39 26
    }
40
41
    /**
42
     * Allows to clear the index which means the index will be excluded from tables index list.
43
     *
44
     * @return SchemaIndexDefinitionEventArgs
45
     */
46
    public function setIndex(?Index $index = null)
47
    {
48
        $this->index = $index;
49
50
        return $this;
51
    }
52
53
    /**
54
     * @return Index|null
55
     */
56 26
    public function getIndex()
57
    {
58 26
        return $this->index;
59
    }
60
61
    /**
62
     * @return mixed[]
63
     */
64
    public function getTableIndex()
65
    {
66
        return $this->tableIndex;
67
    }
68
69
    /**
70
     * @return string
71
     */
72
    public function getTable()
73
    {
74
        return $this->table;
75
    }
76
77
    /**
78
     * @return Connection
79
     */
80
    public function getConnection()
81
    {
82
        return $this->connection;
83
    }
84
85
    /**
86
     * @return AbstractPlatform
87
     */
88
    public function getDatabasePlatform()
89
    {
90
        return $this->connection->getDatabasePlatform();
91
    }
92
}
93