[FEATURE] Doctrine: Implement SchemaMigrationService
[Packages/TYPO3.CMS.git] / typo3 / sysext / core / Classes / Database / Schema / Parser / AST / DataType / AbstractDataType.php
1 <?php
2 declare(strict_types=1);
3
4 namespace TYPO3\CMS\Core\Database\Schema\Parser\AST\DataType;
5
6 /*
7 * This file is part of the TYPO3 CMS project.
8 *
9 * It is free software; you can redistribute it and/or modify it under
10 * the terms of the GNU General Public License, either version 2
11 * of the License, or any later version.
12 *
13 * For the full copyright and license information, please read the
14 * LICENSE.txt file that was distributed with this source code.
15 *
16 * The TYPO3 project - inspiring people to share!
17 */
18
19 /**
20 * Base class for all data types that contains properties
21 * common to all data types.
22 */
23 abstract class AbstractDataType
24 {
25 /**
26 * Used by most field types for length/precision information
27 *
28 * @var int
29 */
30 protected $length = 0;
31
32 /**
33 * Used for floating point type columns
34 * -1 is used to indicate that no value has been set.
35 *
36 * @var int
37 */
38 protected $precision = -1;
39
40 /**
41 * Used for floating point type columns
42 * -1 is used to indicate that no value has been set.
43 *
44 * @var int
45 */
46 protected $scale = -1;
47
48 /**
49 * Differentiate between CHAR/VARCHAR and BINARY/VARBINARY
50 *
51 * @var bool
52 */
53 protected $fixed = false;
54
55 /**
56 * Unsigned flag for numeric columns
57 *
58 * @var bool
59 */
60 protected $unsigned = false;
61
62 /**
63 * Extra options for a column that control specific features/flags
64 *
65 * @var array
66 */
67 protected $options = [];
68
69 /**
70 * Options for ENUM/SET data types
71 *
72 * @var array
73 */
74 protected $values;
75
76 /**
77 * @return int
78 */
79 public function getLength(): int
80 {
81 return $this->length;
82 }
83
84 /**
85 * @param int $length
86 */
87 public function setLength(int $length)
88 {
89 $this->length = $length;
90 }
91
92 /**
93 * @return int
94 */
95 public function getPrecision(): int
96 {
97 return $this->precision;
98 }
99
100 /**
101 * @param int $precision
102 */
103 public function setPrecision(int $precision)
104 {
105 $this->precision = $precision;
106 }
107
108 /**
109 * @return int
110 */
111 public function getScale(): int
112 {
113 return $this->scale;
114 }
115
116 /**
117 * @param int $scale
118 */
119 public function setScale(int $scale)
120 {
121 $this->scale = $scale;
122 }
123
124 /**
125 * @return bool
126 */
127 public function isFixed(): bool
128 {
129 return $this->fixed;
130 }
131
132 /**
133 * @param bool $fixed
134 */
135 public function setFixed(bool $fixed)
136 {
137 $this->fixed = $fixed;
138 }
139
140 /**
141 * @return array
142 */
143 public function getOptions(): array
144 {
145 return $this->options;
146 }
147
148 /**
149 * @param array $options
150 */
151 public function setOptions(array $options)
152 {
153 $this->options = $options;
154 }
155
156 /**
157 * @return bool
158 */
159 public function isUnsigned(): bool
160 {
161 return $this->unsigned;
162 }
163
164 /**
165 * @param bool $unsigned
166 */
167 public function setUnsigned(bool $unsigned)
168 {
169 $this->unsigned = $unsigned;
170 }
171
172 /**
173 * @return array
174 */
175 public function getValues(): array
176 {
177 return $this->values;
178 }
179
180 /**
181 * @param array $values
182 */
183 public function setValues(array $values)
184 {
185 $this->values = $values;
186 }
187 }