|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Doctrine\DBAL\Event; |
|
4
|
|
|
|
|
5
|
|
|
use Doctrine\DBAL\Platforms\AbstractPlatform; |
|
6
|
|
|
use Doctrine\DBAL\Schema\Column; |
|
7
|
|
|
use Doctrine\DBAL\Schema\TableDiff; |
|
8
|
|
|
use function array_merge; |
|
9
|
|
|
use function func_get_args; |
|
10
|
|
|
use function is_array; |
|
11
|
|
|
|
|
12
|
|
|
/** |
|
13
|
|
|
* Event Arguments used when SQL queries for renaming table columns are generated inside Doctrine\DBAL\Platform\*Platform. |
|
14
|
|
|
*/ |
|
15
|
|
|
class SchemaAlterTableRenameColumnEventArgs extends SchemaEventArgs |
|
16
|
|
|
{ |
|
17
|
|
|
/** @var string */ |
|
18
|
|
|
private $oldColumnName; |
|
19
|
|
|
|
|
20
|
|
|
/** @var Column */ |
|
21
|
|
|
private $column; |
|
22
|
|
|
|
|
23
|
|
|
/** @var TableDiff */ |
|
24
|
|
|
private $tableDiff; |
|
25
|
|
|
|
|
26
|
|
|
/** @var AbstractPlatform */ |
|
27
|
|
|
private $platform; |
|
28
|
|
|
|
|
29
|
|
|
/** @var string[] */ |
|
30
|
|
|
private $sql = []; |
|
31
|
|
|
|
|
32
|
|
|
/** |
|
33
|
|
|
* @param string $oldColumnName |
|
34
|
|
|
*/ |
|
35
|
486 |
|
public function __construct($oldColumnName, Column $column, TableDiff $tableDiff, AbstractPlatform $platform) |
|
36
|
|
|
{ |
|
37
|
486 |
|
$this->oldColumnName = $oldColumnName; |
|
38
|
486 |
|
$this->column = $column; |
|
39
|
486 |
|
$this->tableDiff = $tableDiff; |
|
40
|
486 |
|
$this->platform = $platform; |
|
41
|
486 |
|
} |
|
42
|
|
|
|
|
43
|
|
|
/** |
|
44
|
|
|
* @return string |
|
45
|
|
|
*/ |
|
46
|
|
|
public function getOldColumnName() |
|
47
|
|
|
{ |
|
48
|
|
|
return $this->oldColumnName; |
|
49
|
|
|
} |
|
50
|
|
|
|
|
51
|
|
|
/** |
|
52
|
|
|
* @return Column |
|
53
|
|
|
*/ |
|
54
|
|
|
public function getColumn() |
|
55
|
|
|
{ |
|
56
|
|
|
return $this->column; |
|
57
|
|
|
} |
|
58
|
|
|
|
|
59
|
|
|
/** |
|
60
|
|
|
* @return TableDiff |
|
61
|
|
|
*/ |
|
62
|
|
|
public function getTableDiff() |
|
63
|
|
|
{ |
|
64
|
|
|
return $this->tableDiff; |
|
65
|
|
|
} |
|
66
|
|
|
|
|
67
|
|
|
/** |
|
68
|
|
|
* @return AbstractPlatform |
|
69
|
|
|
*/ |
|
70
|
|
|
public function getPlatform() |
|
71
|
|
|
{ |
|
72
|
|
|
return $this->platform; |
|
73
|
|
|
} |
|
74
|
|
|
|
|
75
|
|
|
/** |
|
76
|
|
|
* Passing multiple SQL statements as an array is deprecated. Pass each statement as an individual argument instead. |
|
77
|
|
|
* |
|
78
|
|
|
* @param string|string[] $sql |
|
79
|
|
|
* |
|
80
|
|
|
* @return \Doctrine\DBAL\Event\SchemaAlterTableRenameColumnEventArgs |
|
81
|
|
|
*/ |
|
82
|
|
|
public function addSql($sql) |
|
83
|
|
|
{ |
|
84
|
|
|
$this->sql = array_merge($this->sql, is_array($sql) ? $sql : func_get_args()); |
|
85
|
|
|
|
|
86
|
|
|
return $this; |
|
87
|
|
|
} |
|
88
|
|
|
|
|
89
|
|
|
/** |
|
90
|
|
|
* @return string[] |
|
91
|
|
|
*/ |
|
92
|
486 |
|
public function getSql() |
|
93
|
|
|
{ |
|
94
|
486 |
|
return $this->sql; |
|
95
|
|
|
} |
|
96
|
|
|
} |
|
97
|
|
|
|