SchemaDropTableEventArgs.php 1.19 KB
Newer Older
1 2
<?php

Michael Moravec's avatar
Michael Moravec committed
3 4
declare(strict_types=1);

5 6
namespace Doctrine\DBAL\Event;

Benjamin Morel's avatar
Benjamin Morel committed
7 8
use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Schema\Table;
9
use InvalidArgumentException;
10 11 12 13 14 15

/**
 * Event Arguments used when the SQL query for dropping tables are generated inside Doctrine\DBAL\Platform\AbstractPlatform.
 */
class SchemaDropTableEventArgs extends SchemaEventArgs
{
16
    /** @var string|Table */
17
    private $table;
18

19
    /** @var AbstractPlatform */
20
    private $platform;
21

22
    /** @var string|null */
23
    private $sql = null;
24 25

    /**
26
     * @param string|Table $table
Benjamin Morel's avatar
Benjamin Morel committed
27
     *
28
     * @throws InvalidArgumentException
29 30 31
     */
    public function __construct($table, AbstractPlatform $platform)
    {
32 33
        $this->table    = $table;
        $this->platform = $platform;
34 35 36
    }

    /**
37
     * @return string|Table
38 39 40
     */
    public function getTable()
    {
41
        return $this->table;
42 43
    }

44
    public function getPlatform() : AbstractPlatform
45
    {
46
        return $this->platform;
47 48 49
    }

    /**
50
     * @return $this
51
     */
52
    public function setSql(string $sql) : self
53
    {
54
        $this->sql = $sql;
55 56 57 58

        return $this;
    }

59
    public function getSql() : ?string
60
    {
61
        return $this->sql;
62 63
    }
}