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\Connection, |
---|
23 | Doctrine\DBAL\Schema\Column; |
---|
24 | |
---|
25 | /** |
---|
26 | * Event Arguments used when the portable column definition is generated inside Doctrine\DBAL\Schema\AbstractSchemaManager. |
---|
27 | * |
---|
28 | * @license http://www.opensource.org/licenses/lgpl-license.php LGPL |
---|
29 | * @link www.doctrine-project.com |
---|
30 | * @since 2.2 |
---|
31 | * @author Jan Sorgalla <jsorgalla@googlemail.com> |
---|
32 | */ |
---|
33 | class SchemaColumnDefinitionEventArgs extends SchemaEventArgs |
---|
34 | { |
---|
35 | /** |
---|
36 | * @var \Doctrine\DBAL\Schema\Column |
---|
37 | */ |
---|
38 | private $_column = null; |
---|
39 | |
---|
40 | /** |
---|
41 | * Raw column data as fetched from the database |
---|
42 | * |
---|
43 | * @var array |
---|
44 | */ |
---|
45 | private $_tableColumn = null; |
---|
46 | |
---|
47 | /** |
---|
48 | * @var string |
---|
49 | */ |
---|
50 | private $_table = null; |
---|
51 | |
---|
52 | /** |
---|
53 | * @var string |
---|
54 | */ |
---|
55 | private $_database = null; |
---|
56 | |
---|
57 | /** |
---|
58 | * @var \Doctrine\DBAL\Connection |
---|
59 | */ |
---|
60 | private $_connection = null; |
---|
61 | |
---|
62 | /** |
---|
63 | * @param array $tableColumn |
---|
64 | * @param string $table |
---|
65 | * @param string $database |
---|
66 | * @param \Doctrine\DBAL\Connection $conn |
---|
67 | */ |
---|
68 | public function __construct(array $tableColumn, $table, $database, Connection $connection) |
---|
69 | { |
---|
70 | $this->_tableColumn = $tableColumn; |
---|
71 | $this->_table = $table; |
---|
72 | $this->_database = $database; |
---|
73 | $this->_connection = $connection; |
---|
74 | } |
---|
75 | |
---|
76 | /** |
---|
77 | * Allows to clear the column which means the column will be excluded from |
---|
78 | * tables column list. |
---|
79 | * |
---|
80 | * @param null|\Doctrine\DBAL\Schema\Column $column |
---|
81 | * @return SchemaColumnDefinitionEventArgs |
---|
82 | */ |
---|
83 | public function setColumn(Column $column = null) |
---|
84 | { |
---|
85 | $this->_column = $column; |
---|
86 | |
---|
87 | return $this; |
---|
88 | } |
---|
89 | |
---|
90 | /** |
---|
91 | * @return \Doctrine\DBAL\Schema\Column |
---|
92 | */ |
---|
93 | public function getColumn() |
---|
94 | { |
---|
95 | return $this->_column; |
---|
96 | } |
---|
97 | |
---|
98 | /** |
---|
99 | * @return array |
---|
100 | */ |
---|
101 | public function getTableColumn() |
---|
102 | { |
---|
103 | return $this->_tableColumn; |
---|
104 | } |
---|
105 | |
---|
106 | /** |
---|
107 | * @return string |
---|
108 | */ |
---|
109 | public function getTable() |
---|
110 | { |
---|
111 | return $this->_table; |
---|
112 | } |
---|
113 | |
---|
114 | /** |
---|
115 | * @return string |
---|
116 | */ |
---|
117 | public function getDatabase() |
---|
118 | { |
---|
119 | return $this->_database; |
---|
120 | } |
---|
121 | |
---|
122 | /** |
---|
123 | * @return \Doctrine\DBAL\Connection |
---|
124 | */ |
---|
125 | public function getConnection() |
---|
126 | { |
---|
127 | return $this->_connection; |
---|
128 | } |
---|
129 | |
---|
130 | /** |
---|
131 | * @return \Doctrine\DBAL\Platforms\AbstractPlatform |
---|
132 | */ |
---|
133 | public function getDatabasePlatform() |
---|
134 | { |
---|
135 | return $this->_connection->getDatabasePlatform(); |
---|
136 | } |
---|
137 | } |
---|