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\Schema; |
21
|
|
|
|
22
|
|
|
/** |
23
|
|
|
* Configuration for a Schema. |
24
|
|
|
* |
25
|
|
|
* @link www.doctrine-project.org |
26
|
|
|
* @since 2.0 |
27
|
|
|
* @author Benjamin Eberlei <[email protected]> |
28
|
|
|
*/ |
29
|
|
|
class SchemaConfig |
30
|
|
|
{ |
31
|
|
|
/** |
32
|
|
|
* @var boolean |
33
|
|
|
*/ |
34
|
|
|
protected $hasExplicitForeignKeyIndexes = false; |
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* @var integer |
38
|
|
|
*/ |
39
|
|
|
protected $maxIdentifierLength = 63; |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* @var string |
43
|
|
|
*/ |
44
|
|
|
protected $name; |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* @var array |
48
|
|
|
*/ |
49
|
|
|
protected $defaultTableOptions = []; |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* @return boolean |
53
|
|
|
*/ |
54
|
|
|
public function hasExplicitForeignKeyIndexes() |
55
|
|
|
{ |
56
|
|
|
return $this->hasExplicitForeignKeyIndexes; |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* @param boolean $flag |
61
|
|
|
* |
62
|
|
|
* @return void |
63
|
|
|
*/ |
64
|
|
|
public function setExplicitForeignKeyIndexes($flag) |
65
|
|
|
{ |
66
|
|
|
$this->hasExplicitForeignKeyIndexes = (bool) $flag; |
67
|
|
|
} |
68
|
|
|
|
69
|
|
|
/** |
70
|
|
|
* @param integer $length |
71
|
|
|
* |
72
|
|
|
* @return void |
73
|
|
|
*/ |
74
|
14 |
|
public function setMaxIdentifierLength($length) |
75
|
|
|
{ |
76
|
14 |
|
$this->maxIdentifierLength = (int) $length; |
77
|
14 |
|
} |
78
|
|
|
|
79
|
|
|
/** |
80
|
|
|
* @return integer |
81
|
|
|
*/ |
82
|
8 |
|
public function getMaxIdentifierLength() |
83
|
|
|
{ |
84
|
8 |
|
return $this->maxIdentifierLength; |
85
|
|
|
} |
86
|
|
|
|
87
|
|
|
/** |
88
|
|
|
* Gets the default namespace of schema objects. |
89
|
|
|
* |
90
|
|
|
* @return string |
91
|
|
|
*/ |
92
|
67 |
|
public function getName() |
93
|
|
|
{ |
94
|
67 |
|
return $this->name; |
95
|
|
|
} |
96
|
|
|
|
97
|
|
|
/** |
98
|
|
|
* Sets the default namespace name of schema objects. |
99
|
|
|
* |
100
|
|
|
* @param string $name The value to set. |
101
|
|
|
* |
102
|
|
|
* @return void |
103
|
|
|
*/ |
104
|
7 |
|
public function setName($name) |
105
|
|
|
{ |
106
|
7 |
|
$this->name = $name; |
107
|
7 |
|
} |
108
|
|
|
|
109
|
|
|
/** |
110
|
|
|
* Gets the default options that are passed to Table instances created with |
111
|
|
|
* Schema#createTable(). |
112
|
|
|
* |
113
|
|
|
* @return array |
114
|
|
|
*/ |
115
|
35 |
|
public function getDefaultTableOptions() |
116
|
|
|
{ |
117
|
35 |
|
return $this->defaultTableOptions; |
118
|
|
|
} |
119
|
|
|
|
120
|
|
|
/** |
121
|
|
|
* @param array $defaultTableOptions |
122
|
|
|
* |
123
|
|
|
* @return void |
124
|
|
|
*/ |
125
|
|
|
public function setDefaultTableOptions(array $defaultTableOptions) |
126
|
|
|
{ |
127
|
|
|
$this->defaultTableOptions = $defaultTableOptions; |
128
|
|
|
} |
129
|
|
|
} |
130
|
|
|
|