1 | <?php |
||
2 | |||
3 | namespace Doctrine\DBAL\Event; |
||
4 | |||
5 | use Doctrine\DBAL\Platforms\AbstractPlatform; |
||
6 | use Doctrine\DBAL\Schema\Table; |
||
7 | use InvalidArgumentException; |
||
8 | use function is_string; |
||
9 | |||
10 | /** |
||
11 | * Event Arguments used when the SQL query for dropping tables are generated inside Doctrine\DBAL\Platform\AbstractPlatform. |
||
12 | */ |
||
13 | class SchemaDropTableEventArgs extends SchemaEventArgs |
||
14 | { |
||
15 | /** @var string|Table */ |
||
16 | private $table; |
||
17 | |||
18 | /** @var AbstractPlatform */ |
||
19 | private $platform; |
||
20 | |||
21 | /** @var string|null */ |
||
22 | private $sql = null; |
||
23 | |||
24 | /** |
||
25 | * @param string|Table $table |
||
26 | * |
||
27 | * @throws InvalidArgumentException |
||
28 | */ |
||
29 | 486 | public function __construct($table, AbstractPlatform $platform) |
|
30 | { |
||
31 | 486 | if (! $table instanceof Table && ! is_string($table)) { |
|
0 ignored issues
–
show
introduced
by
Loading history...
|
|||
32 | throw new InvalidArgumentException('SchemaDropTableEventArgs expects $table parameter to be string or \Doctrine\DBAL\Schema\Table.'); |
||
33 | } |
||
34 | |||
35 | 486 | $this->table = $table; |
|
36 | 486 | $this->platform = $platform; |
|
37 | 486 | } |
|
38 | |||
39 | /** |
||
40 | * @return string|Table |
||
41 | */ |
||
42 | public function getTable() |
||
43 | { |
||
44 | return $this->table; |
||
45 | } |
||
46 | |||
47 | /** |
||
48 | * @return AbstractPlatform |
||
49 | */ |
||
50 | public function getPlatform() |
||
51 | { |
||
52 | return $this->platform; |
||
53 | } |
||
54 | |||
55 | /** |
||
56 | * @param string $sql |
||
57 | * |
||
58 | * @return \Doctrine\DBAL\Event\SchemaDropTableEventArgs |
||
59 | */ |
||
60 | public function setSql($sql) |
||
61 | { |
||
62 | $this->sql = $sql; |
||
63 | |||
64 | return $this; |
||
65 | } |
||
66 | |||
67 | /** |
||
68 | * @return string|null |
||
69 | */ |
||
70 | public function getSql() |
||
71 | { |
||
72 | return $this->sql; |
||
73 | } |
||
74 | } |
||
75 |