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 MIT license. 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
|
|
|
use Doctrine\DBAL\Schema\Table; |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* Event Arguments used when the SQL query for dropping tables are generated inside Doctrine\DBAL\Platform\AbstractPlatform. |
27
|
|
|
* |
28
|
|
|
* @link www.doctrine-project.org |
29
|
|
|
* @since 2.2 |
30
|
|
|
* @author Jan Sorgalla <[email protected]> |
31
|
|
|
*/ |
32
|
|
|
class SchemaDropTableEventArgs extends SchemaEventArgs |
33
|
|
|
{ |
34
|
|
|
/** |
35
|
|
|
* @var string|\Doctrine\DBAL\Schema\Table |
36
|
|
|
*/ |
37
|
|
|
private $_table; |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* @var \Doctrine\DBAL\Platforms\AbstractPlatform |
41
|
|
|
*/ |
42
|
|
|
private $_platform; |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* @var string|null |
46
|
|
|
*/ |
47
|
|
|
private $_sql = null; |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* @param string|\Doctrine\DBAL\Schema\Table $table |
51
|
|
|
* @param \Doctrine\DBAL\Platforms\AbstractPlatform $platform |
52
|
|
|
* |
53
|
|
|
* @throws \InvalidArgumentException |
54
|
|
|
*/ |
55
|
16 |
|
public function __construct($table, AbstractPlatform $platform) |
56
|
|
|
{ |
57
|
16 |
|
if ( ! $table instanceof Table && !is_string($table)) { |
58
|
|
|
throw new \InvalidArgumentException('SchemaDropTableEventArgs expects $table parameter to be string or \Doctrine\DBAL\Schema\Table.'); |
59
|
|
|
} |
60
|
|
|
|
61
|
16 |
|
$this->_table = $table; |
62
|
16 |
|
$this->_platform = $platform; |
63
|
16 |
|
} |
64
|
|
|
|
65
|
|
|
/** |
66
|
|
|
* @return string|\Doctrine\DBAL\Schema\Table |
67
|
|
|
*/ |
68
|
|
|
public function getTable() |
69
|
|
|
{ |
70
|
|
|
return $this->_table; |
71
|
|
|
} |
72
|
|
|
|
73
|
|
|
/** |
74
|
|
|
* @return \Doctrine\DBAL\Platforms\AbstractPlatform |
75
|
|
|
*/ |
76
|
|
|
public function getPlatform() |
77
|
|
|
{ |
78
|
|
|
return $this->_platform; |
79
|
|
|
} |
80
|
|
|
|
81
|
|
|
/** |
82
|
|
|
* @param string $sql |
83
|
|
|
* |
84
|
|
|
* @return \Doctrine\DBAL\Event\SchemaDropTableEventArgs |
85
|
|
|
*/ |
86
|
|
|
public function setSql($sql) |
87
|
|
|
{ |
88
|
|
|
$this->_sql = $sql; |
89
|
|
|
|
90
|
|
|
return $this; |
91
|
|
|
} |
92
|
|
|
|
93
|
|
|
/** |
94
|
|
|
* @return string|null |
95
|
|
|
*/ |
96
|
|
|
public function getSql() |
97
|
|
|
{ |
98
|
|
|
return $this->_sql; |
99
|
|
|
} |
100
|
|
|
} |
101
|
|
|
|