Completed
Pull Request — master (#3708)
by Sergei
15:13
created

SchemaCreateTableEventArgs::getColumns()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 3
ccs 0
cts 2
cp 0
rs 10
c 0
b 0
f 0
cc 1
eloc 1
nc 1
nop 0
crap 2
1
<?php
2
3
namespace Doctrine\DBAL\Event;
4
5
use Doctrine\DBAL\Platforms\AbstractPlatform;
6
use Doctrine\DBAL\Schema\Table;
7
use function array_merge;
8
use function func_get_args;
9
use function is_array;
10
11
/**
12
 * Event Arguments used when SQL queries for creating tables are generated inside Doctrine\DBAL\Platform\AbstractPlatform.
13
 */
14
class SchemaCreateTableEventArgs extends SchemaEventArgs
15
{
16
    /** @var Table */
17
    private $table;
18
19
    /** @var mixed[][] */
20
    private $columns;
21
22
    /** @var mixed[] */
23
    private $options;
24
25
    /** @var AbstractPlatform */
26
    private $platform;
27
28
    /** @var string[] */
29
    private $sql = [];
30
31
    /**
32
     * @param mixed[][] $columns
33
     * @param mixed[]   $options
34
     */
35 486
    public function __construct(Table $table, array $columns, array $options, AbstractPlatform $platform)
36
    {
37 486
        $this->table    = $table;
38 486
        $this->columns  = $columns;
39 486
        $this->options  = $options;
40 486
        $this->platform = $platform;
41 486
    }
42
43
    /**
44
     * @return Table
45
     */
46
    public function getTable()
47
    {
48
        return $this->table;
49
    }
50
51
    /**
52
     * @return mixed[][]
53
     */
54
    public function getColumns()
55
    {
56
        return $this->columns;
57
    }
58
59
    /**
60
     * @return mixed[]
61
     */
62
    public function getOptions()
63
    {
64
        return $this->options;
65
    }
66
67
    /**
68
     * @return AbstractPlatform
69
     */
70
    public function getPlatform()
71
    {
72
        return $this->platform;
73
    }
74
75
    /**
76
     * Passing multiple SQL statements as an array is deprecated. Pass each statement as an individual argument instead.
77
     *
78
     * @param string|string[] $sql
79
     *
80
     * @return \Doctrine\DBAL\Event\SchemaCreateTableEventArgs
81
     */
82
    public function addSql($sql)
83
    {
84
        $this->sql = array_merge($this->sql, is_array($sql) ? $sql : func_get_args());
85
86
        return $this;
87
    }
88
89
    /**
90
     * @return string[]
91
     */
92
    public function getSql()
93
    {
94
        return $this->sql;
95
    }
96
}
97