1 | <?php |
---|
2 | /* |
---|
3 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
---|
4 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
---|
5 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
---|
6 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
---|
7 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
---|
8 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
---|
9 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
---|
10 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
---|
11 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
---|
12 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
---|
13 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
---|
14 | * |
---|
15 | * This software consists of voluntary contributions made by many individuals |
---|
16 | * and is licensed under the LGPL. For more information, see |
---|
17 | * <http://www.doctrine-project.org>. |
---|
18 | */ |
---|
19 | |
---|
20 | namespace Doctrine\DBAL\Event; |
---|
21 | |
---|
22 | use Doctrine\DBAL\Platforms\AbstractPlatform, |
---|
23 | Doctrine\DBAL\Schema\Column, |
---|
24 | Doctrine\DBAL\Schema\TableDiff; |
---|
25 | |
---|
26 | /** |
---|
27 | * Event Arguments used when SQL queries for adding table columns are generated inside Doctrine\DBAL\Platform\*Platform. |
---|
28 | * |
---|
29 | * @license http://www.opensource.org/licenses/lgpl-license.php LGPL |
---|
30 | * @link www.doctrine-project.com |
---|
31 | * @since 2.2 |
---|
32 | * @author Jan Sorgalla <jsorgalla@googlemail.com> |
---|
33 | */ |
---|
34 | class SchemaAlterTableAddColumnEventArgs extends SchemaEventArgs |
---|
35 | { |
---|
36 | /** |
---|
37 | * @var \Doctrine\DBAL\Schema\Column |
---|
38 | */ |
---|
39 | private $_column = null; |
---|
40 | |
---|
41 | /** |
---|
42 | * @var \Doctrine\DBAL\Schema\TableDiff |
---|
43 | */ |
---|
44 | private $_tableDiff = null; |
---|
45 | |
---|
46 | /** |
---|
47 | * @var \Doctrine\DBAL\Platforms\AbstractPlatform |
---|
48 | */ |
---|
49 | private $_platform = null; |
---|
50 | |
---|
51 | /** |
---|
52 | * @var array |
---|
53 | */ |
---|
54 | private $_sql = array(); |
---|
55 | |
---|
56 | /** |
---|
57 | * @param \Doctrine\DBAL\Schema\Column $column |
---|
58 | * @param \Doctrine\DBAL\Schema\TableDiff $tableDiff |
---|
59 | * @param \Doctrine\DBAL\Platforms\AbstractPlatform $platform |
---|
60 | */ |
---|
61 | public function __construct(Column $column, TableDiff $tableDiff, AbstractPlatform $platform) |
---|
62 | { |
---|
63 | $this->_column = $column; |
---|
64 | $this->_tableDiff = $tableDiff; |
---|
65 | $this->_platform = $platform; |
---|
66 | } |
---|
67 | |
---|
68 | /** |
---|
69 | * @return \Doctrine\DBAL\Schema\Column |
---|
70 | */ |
---|
71 | public function getColumn() |
---|
72 | { |
---|
73 | return $this->_column; |
---|
74 | } |
---|
75 | |
---|
76 | /** |
---|
77 | * @return \Doctrine\DBAL\Schema\TableDiff |
---|
78 | */ |
---|
79 | public function getTableDiff() |
---|
80 | { |
---|
81 | return $this->_tableDiff; |
---|
82 | } |
---|
83 | |
---|
84 | /** |
---|
85 | * @return \Doctrine\DBAL\Platforms\AbstractPlatform |
---|
86 | */ |
---|
87 | public function getPlatform() |
---|
88 | { |
---|
89 | return $this->_platform; |
---|
90 | } |
---|
91 | |
---|
92 | /** |
---|
93 | * @param string|array $sql |
---|
94 | * @return \Doctrine\DBAL\Event\SchemaAlterTableAddColumnEventArgs |
---|
95 | */ |
---|
96 | public function addSql($sql) |
---|
97 | { |
---|
98 | if (is_array($sql)) { |
---|
99 | $this->_sql = array_merge($this->_sql, $sql); |
---|
100 | } else { |
---|
101 | $this->_sql[] = $sql; |
---|
102 | } |
---|
103 | |
---|
104 | return $this; |
---|
105 | } |
---|
106 | |
---|
107 | /** |
---|
108 | * @return array |
---|
109 | */ |
---|
110 | public function getSql() |
---|
111 | { |
---|
112 | return $this->_sql; |
---|
113 | } |
---|
114 | } |
---|