|
3 | 3 | declare(strict_types=1); |
4 | 4 |
|
5 | 5 | use Contao\DC_Table; |
| 6 | +use Doctrine\DBAL\Types\Types; |
6 | 7 |
|
7 | 8 | $GLOBALS['TL_DCA']['tl_form_layout'] = [ |
8 | 9 | 'config' => [ |
|
87 | 88 | 'id' => [ |
88 | 89 | 'label' => ['ID'], |
89 | 90 | 'search' => true, |
90 | | - 'sql' => 'int(10) unsigned NOT NULL auto_increment', |
| 91 | + 'sql' => [ |
| 92 | + 'type' => Types::INTEGER, |
| 93 | + 'unsigned' => true, |
| 94 | + 'autoincrement' => true, |
| 95 | + 'notnull' => true, |
| 96 | + ], |
91 | 97 | ], |
92 | 98 | 'pid' => [ |
93 | 99 | 'foreignKey' => 'tl_theme.name', |
94 | | - 'sql' => "int(10) unsigned NOT NULL default '0'", |
| 100 | + 'sql' => ['type' => Types::INTEGER, 'unsigned' => true, 'default' => 0, 'notnull' => true], |
95 | 101 | 'relation' => ['type' => 'belongsTo', 'load' => 'lazy'], |
96 | 102 | ], |
97 | | - 'tstamp' => ['sql' => "int(10) unsigned NOT NULL default '0'"], |
| 103 | + 'tstamp' => [ |
| 104 | + 'sql' => ['type' => Types::INTEGER, 'unsigned' => true, 'default' => 0, 'notnull' => true], |
| 105 | + ], |
98 | 106 | 'title' => [ |
99 | 107 | 'exclude' => true, |
100 | 108 | 'inputType' => 'text', |
101 | 109 | 'search' => true, |
102 | 110 | 'eval' => ['mandatory' => true, 'maxlength' => 255, 'tl_class' => 'w50'], |
103 | | - 'sql' => "varchar(255) NOT NULL default ''", |
| 111 | + 'sql' => ['type' => Types::STRING, 'length' => 255, 'default' => '', 'notnull' => true], |
104 | 112 | ], |
105 | 113 | 'type' => [ |
106 | 114 | 'exclude' => true, |
|
114 | 122 | 'chosen' => true, |
115 | 123 | 'submitOnChange' => true, |
116 | 124 | ], |
117 | | - 'sql' => "varchar(32) NOT NULL default ''", |
| 125 | + 'sql' => ['type' => Types::STRING, 'length' => 32, 'default' => '', 'notnull' => true], |
118 | 126 | ], |
119 | 127 | 'defaultLayout' => [ |
120 | 128 | 'exclude' => true, |
121 | 129 | 'inputType' => 'checkbox', |
122 | 130 | 'eval' => ['tl_class' => 'w50'], |
123 | | - 'sql' => "char(1) NOT NULL default ''", |
| 131 | + 'sql' => [ |
| 132 | + 'type' => Types::STRING, |
| 133 | + 'length' => 1, |
| 134 | + 'fixed' => true, |
| 135 | + 'default' => '', |
| 136 | + 'notnull' => true, |
| 137 | + ], |
124 | 138 | ], |
125 | 139 | 'widgets' => [ |
126 | 140 | 'exclude' => true, |
|
166 | 180 | ], |
167 | 181 | ], |
168 | 182 | 'eval' => ['tl_class' => 'clr long'], |
169 | | - 'sql' => 'blob NULL', |
| 183 | + 'sql' => ['type' => Types::BLOB, 'notnull' => false], |
170 | 184 | ], |
171 | 185 | 'fallbackLayout' => [ |
172 | 186 | 'exclude' => true, |
173 | 187 | 'inputType' => 'select', |
174 | 188 | 'options_callback' => ['netzmacht.contao_form_designer.listener.dca.form_layout', 'getLayoutTemplates'], |
175 | 189 | 'eval' => ['tl_class' => 'w50', 'includeBlankOption' => true, 'chosen' => true], |
176 | | - 'sql' => "varchar(64) NOT NULL default ''", |
| 190 | + 'sql' => ['type' => Types::STRING, 'length' => 64, 'default' => '', 'notnull' => true], |
177 | 191 | ], |
178 | 192 | 'fallbackControl' => [ |
179 | 193 | 'exclude' => true, |
180 | 194 | 'inputType' => 'select', |
181 | 195 | 'options_callback' => ['netzmacht.contao_form_designer.listener.dca.form_layout', 'getControlTemplates'], |
182 | 196 | 'eval' => ['tl_class' => 'w50', 'includeBlankOption' => true, 'chosen' => true], |
183 | | - 'sql' => "varchar(64) NOT NULL default ''", |
| 197 | + 'sql' => ['type' => Types::STRING, 'length' => 64, 'default' => '', 'notnull' => true], |
184 | 198 | ], |
185 | 199 | 'fallbackLabel' => [ |
186 | 200 | 'exclude' => true, |
187 | 201 | 'inputType' => 'select', |
188 | 202 | 'options_callback' => ['netzmacht.contao_form_designer.listener.dca.form_layout', 'getLabelTemplates'], |
189 | 203 | 'eval' => ['tl_class' => 'w50', 'includeBlankOption' => true, 'chosen' => true], |
190 | | - 'sql' => "varchar(64) NOT NULL default ''", |
| 204 | + 'sql' => ['type' => Types::STRING, 'length' => 64, 'default' => '', 'notnull' => true], |
191 | 205 | ], |
192 | 206 | 'fallbackError' => [ |
193 | 207 | 'exclude' => true, |
194 | 208 | 'inputType' => 'select', |
195 | 209 | 'options_callback' => ['netzmacht.contao_form_designer.listener.dca.form_layout', 'getErrorTemplates'], |
196 | 210 | 'eval' => ['tl_class' => 'w50', 'includeBlankOption' => true, 'chosen' => true], |
197 | | - 'sql' => "varchar(64) NOT NULL default ''", |
| 211 | + 'sql' => ['type' => Types::STRING, 'length' => 64, 'default' => '', 'notnull' => true], |
198 | 212 | ], |
199 | 213 | 'fallbackHelp' => [ |
200 | 214 | 'exclude' => true, |
201 | 215 | 'inputType' => 'select', |
202 | 216 | 'options_callback' => ['netzmacht.contao_form_designer.listener.dca.form_layout', 'getHelpTemplates'], |
203 | 217 | 'eval' => ['tl_class' => 'w50', 'includeBlankOption' => true, 'chosen' => true], |
204 | | - 'sql' => "varchar(64) NOT NULL default ''", |
| 218 | + 'sql' => ['type' => Types::STRING, 'length' => 64, 'default' => '', 'notnull' => true], |
205 | 219 | ], |
206 | 220 | ], |
207 | 221 | ]; |
0 commit comments