|
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\Column; |
|
8
|
|
|
|
|
9
|
|
|
/** |
|
10
|
|
|
* Event Arguments used when the portable column definition is generated inside Doctrine\DBAL\Schema\AbstractSchemaManager. |
|
11
|
|
|
*/ |
|
12
|
|
|
class SchemaColumnDefinitionEventArgs extends SchemaEventArgs |
|
13
|
|
|
{ |
|
14
|
|
|
/** @var Column|null */ |
|
15
|
|
|
private $column = null; |
|
16
|
|
|
|
|
17
|
|
|
/** |
|
18
|
|
|
* Raw column data as fetched from the database. |
|
19
|
|
|
* |
|
20
|
|
|
* @var mixed[] |
|
21
|
|
|
*/ |
|
22
|
|
|
private $tableColumn; |
|
23
|
|
|
|
|
24
|
|
|
/** @var string */ |
|
25
|
|
|
private $table; |
|
26
|
|
|
|
|
27
|
|
|
/** @var string */ |
|
28
|
|
|
private $database; |
|
29
|
|
|
|
|
30
|
|
|
/** @var Connection */ |
|
31
|
|
|
private $connection; |
|
32
|
|
|
|
|
33
|
|
|
/** |
|
34
|
|
|
* @param mixed[] $tableColumn |
|
35
|
|
|
* @param string $table |
|
36
|
|
|
* @param string $database |
|
37
|
|
|
*/ |
|
38
|
26 |
|
public function __construct(array $tableColumn, $table, $database, Connection $connection) |
|
39
|
|
|
{ |
|
40
|
26 |
|
$this->tableColumn = $tableColumn; |
|
41
|
26 |
|
$this->table = $table; |
|
42
|
26 |
|
$this->database = $database; |
|
43
|
26 |
|
$this->connection = $connection; |
|
44
|
26 |
|
} |
|
45
|
|
|
|
|
46
|
|
|
/** |
|
47
|
|
|
* Allows to clear the column which means the column will be excluded from |
|
48
|
|
|
* tables column list. |
|
49
|
|
|
* |
|
50
|
|
|
* @return \Doctrine\DBAL\Event\SchemaColumnDefinitionEventArgs |
|
51
|
|
|
*/ |
|
52
|
|
|
public function setColumn(?Column $column = null) |
|
53
|
|
|
{ |
|
54
|
|
|
$this->column = $column; |
|
55
|
|
|
|
|
56
|
|
|
return $this; |
|
57
|
|
|
} |
|
58
|
|
|
|
|
59
|
|
|
/** |
|
60
|
|
|
* @return Column|null |
|
61
|
|
|
*/ |
|
62
|
26 |
|
public function getColumn() |
|
63
|
|
|
{ |
|
64
|
26 |
|
return $this->column; |
|
65
|
|
|
} |
|
66
|
|
|
|
|
67
|
|
|
/** |
|
68
|
|
|
* @return mixed[] |
|
69
|
|
|
*/ |
|
70
|
|
|
public function getTableColumn() |
|
71
|
|
|
{ |
|
72
|
|
|
return $this->tableColumn; |
|
73
|
|
|
} |
|
74
|
|
|
|
|
75
|
|
|
/** |
|
76
|
|
|
* @return string |
|
77
|
|
|
*/ |
|
78
|
|
|
public function getTable() |
|
79
|
|
|
{ |
|
80
|
|
|
return $this->table; |
|
81
|
|
|
} |
|
82
|
|
|
|
|
83
|
|
|
/** |
|
84
|
|
|
* @return string |
|
85
|
|
|
*/ |
|
86
|
|
|
public function getDatabase() |
|
87
|
|
|
{ |
|
88
|
|
|
return $this->database; |
|
89
|
|
|
} |
|
90
|
|
|
|
|
91
|
|
|
/** |
|
92
|
|
|
* @return Connection |
|
93
|
|
|
*/ |
|
94
|
|
|
public function getConnection() |
|
95
|
|
|
{ |
|
96
|
|
|
return $this->connection; |
|
97
|
|
|
} |
|
98
|
|
|
|
|
99
|
|
|
/** |
|
100
|
|
|
* @deprecated Use SchemaColumnDefinitionEventArgs::getConnection() and Connection::getDatabasePlatform() instead. |
|
101
|
|
|
* |
|
102
|
|
|
* @return AbstractPlatform |
|
103
|
|
|
*/ |
|
104
|
|
|
public function getDatabasePlatform() |
|
105
|
|
|
{ |
|
106
|
|
|
return $this->connection->getDatabasePlatform(); |
|
107
|
|
|
} |
|
108
|
|
|
} |
|
109
|
|
|
|