diff --git a/typo3/sysext/core/Classes/Database/Schema/DefaultTcaSchema.php b/typo3/sysext/core/Classes/Database/Schema/DefaultTcaSchema.php index ef07cb103a4727acce0d4f15c766b35bb550bad1..3cf480c5b34446a819705ecf2bdea892f714d3cb 100644 --- a/typo3/sysext/core/Classes/Database/Schema/DefaultTcaSchema.php +++ b/typo3/sysext/core/Classes/Database/Schema/DefaultTcaSchema.php @@ -657,7 +657,7 @@ class DefaultTcaSchema } $tables[$tablePosition]->addColumn( $this->quote($fieldName), - 'integer', + Types::INTEGER, [ 'default' => 0, 'notnull' => true, @@ -676,23 +676,39 @@ class DefaultTcaSchema if (isset($fieldConfig['config']['MM'])) { $tables[$tablePosition]->addColumn( $this->quote($fieldName), - 'integer', + Types::INTEGER, [ - 'default' => 0, - 'notnull' => true, - 'unsigned' => true, - ] + 'default' => 0, + 'notnull' => true, + 'unsigned' => true, + ] ); } else { $tables[$tablePosition]->addColumn( $this->quote($fieldName), - 'text', + Types::TEXT, [ 'notnull' => false, ] ); } } + + // Add fields for all tables, defining flex columns (TCA type=flex) + foreach ($tableDefinition['columns'] as $fieldName => $fieldConfig) { + if ((string)($fieldConfig['config']['type'] ?? '') !== 'flex' + || $this->isColumnDefinedForTable($tables, $tableName, $fieldName) + ) { + continue; + } + $tables[$tablePosition]->addColumn( + $this->quote($fieldName), + Types::TEXT, + [ + 'notnull' => false, + ] + ); + } } return $tables; diff --git a/typo3/sysext/core/Documentation/Changelog/13.0/Feature-101553-Auto-createDBFieldsFromTCAColumns.rst b/typo3/sysext/core/Documentation/Changelog/13.0/Feature-101553-Auto-createDBFieldsFromTCAColumns.rst index 7659ea870cfee6f3f57a3869819d14f55d81e0e8..a79f14f184870cfa372b2d64a08540b0c842980e 100644 --- a/typo3/sysext/core/Documentation/Changelog/13.0/Feature-101553-Auto-createDBFieldsFromTCAColumns.rst +++ b/typo3/sysext/core/Documentation/Changelog/13.0/Feature-101553-Auto-createDBFieldsFromTCAColumns.rst @@ -60,6 +60,7 @@ Columns are auto-created for these :php:`TCA` :php:`columns` types: * :php:`type = 'imageManipulation'` - new with core v13 * :php:`type = 'language'` - new with core v13 * :php:`type = 'group'` - new with core v13 +* :php:`type = 'flex'` - new with core v13 .. index:: TCA, ext:core, NotScanned diff --git a/typo3/sysext/core/Tests/Functional/Fixtures/Extensions/test_flex_section_container/ext_tables.sql b/typo3/sysext/core/Tests/Functional/Fixtures/Extensions/test_flex_section_container/ext_tables.sql index 8ab428b27c46305387314026d7e9e9084e0f5a57..be29bbaef7771cb7fa272b321ec02abc7e11a4e9 100644 --- a/typo3/sysext/core/Tests/Functional/Fixtures/Extensions/test_flex_section_container/ext_tables.sql +++ b/typo3/sysext/core/Tests/Functional/Fixtures/Extensions/test_flex_section_container/ext_tables.sql @@ -1,3 +1,2 @@ CREATE TABLE tx_testflexsectioncontainer ( - flex_1 text ); diff --git a/typo3/sysext/core/Tests/Functional/Fixtures/Extensions/test_irre_foreignfield/ext_tables.sql b/typo3/sysext/core/Tests/Functional/Fixtures/Extensions/test_irre_foreignfield/ext_tables.sql index 22b73e7c28fe19e8a4a65281ee2727f734a8d568..559f397cf6a2bf2e07891e554f3cdf39b7854be5 100644 --- a/typo3/sysext/core/Tests/Functional/Fixtures/Extensions/test_irre_foreignfield/ext_tables.sql +++ b/typo3/sysext/core/Tests/Functional/Fixtures/Extensions/test_irre_foreignfield/ext_tables.sql @@ -37,6 +37,5 @@ CREATE TABLE pages CREATE TABLE tt_content ( - tx_testirreforeignfield_hotels int(11) DEFAULT '0' NOT NULL, - tx_testirreforeignfield_flexform mediumtext + tx_testirreforeignfield_hotels int(11) DEFAULT '0' NOT NULL ); diff --git a/typo3/sysext/core/Tests/Functional/Fixtures/Extensions/test_irre_foreignfield_non_ws/ext_tables.sql b/typo3/sysext/core/Tests/Functional/Fixtures/Extensions/test_irre_foreignfield_non_ws/ext_tables.sql index efcf797153a7295363dc5410164f702a84478749..4529c6e08d7c177bee2fbd72059587f7d64878a8 100644 --- a/typo3/sysext/core/Tests/Functional/Fixtures/Extensions/test_irre_foreignfield_non_ws/ext_tables.sql +++ b/typo3/sysext/core/Tests/Functional/Fixtures/Extensions/test_irre_foreignfield_non_ws/ext_tables.sql @@ -32,6 +32,5 @@ CREATE TABLE pages CREATE TABLE tt_content ( - tx_testirreforeignfieldnonws_hotels int(11) DEFAULT '0' NOT NULL, - tx_testirreforeignfieldnonws_flexform mediumtext + tx_testirreforeignfieldnonws_hotels int(11) DEFAULT '0' NOT NULL ); diff --git a/typo3/sysext/core/Tests/Functional/Fixtures/Extensions/test_select_flex_mm/ext_tables.sql b/typo3/sysext/core/Tests/Functional/Fixtures/Extensions/test_select_flex_mm/ext_tables.sql index 61fdaf982d1f9669c13cd621c96d8b4e99847f91..5b20d63c063debc1d532c8400f29b476ae2801ee 100644 --- a/typo3/sysext/core/Tests/Functional/Fixtures/Extensions/test_select_flex_mm/ext_tables.sql +++ b/typo3/sysext/core/Tests/Functional/Fixtures/Extensions/test_select_flex_mm/ext_tables.sql @@ -1,5 +1,4 @@ CREATE TABLE tx_testselectflexmm_local ( - flex_1 text ); # MM tables for fields defined in flex form data structures diff --git a/typo3/sysext/core/Tests/Unit/Database/Schema/DefaultTcaSchemaTest.php b/typo3/sysext/core/Tests/Unit/Database/Schema/DefaultTcaSchemaTest.php index fafb775594413979775bd6858304ea6ad7d0d26f..e58d88cb905b4be3a3aec7f1bf1059430427ce6f 100644 --- a/typo3/sysext/core/Tests/Unit/Database/Schema/DefaultTcaSchemaTest.php +++ b/typo3/sysext/core/Tests/Unit/Database/Schema/DefaultTcaSchemaTest.php @@ -1170,4 +1170,26 @@ final class DefaultTcaSchemaTest extends UnitTestCase ); self::assertSame($expectedColumn->toArray(), $result[0]->getColumn('groupWithMM')->toArray()); } + + /** + * @test + */ + public function enrichAddsFlex(): void + { + $GLOBALS['TCA']['aTable']['columns']['flex'] = [ + 'label' => 'aLabel', + 'config' => [ + 'type' => 'flex', + ], + ]; + $result = $this->subject->enrich([$this->defaultTable]); + $expectedColumn = new Column( + '`flex`', + Type::getType('text'), + [ + 'notnull' => false, + ] + ); + self::assertSame($expectedColumn->toArray(), $result[0]->getColumn('flex')->toArray()); + } } diff --git a/typo3/sysext/core/ext_tables.sql b/typo3/sysext/core/ext_tables.sql index 0288286cf405f50718f0a2e4d0d81776395adcf9..8037f185e5da4b304ed183599403ffde91907e20 100644 --- a/typo3/sysext/core/ext_tables.sql +++ b/typo3/sysext/core/ext_tables.sql @@ -145,7 +145,6 @@ CREATE TABLE sys_filemounts ( CREATE TABLE sys_file_storage ( name varchar(255) DEFAULT '' NOT NULL, driver tinytext, - configuration text, is_public tinyint(4) DEFAULT '0' NOT NULL, processingfolder tinytext ); diff --git a/typo3/sysext/frontend/ext_tables.sql b/typo3/sysext/frontend/ext_tables.sql index 66d5cc1e2e38c7971c69a03b3383bf563c538288..2f28d7950a7c66b30b1acf43e6a552bfc64425a8 100644 --- a/typo3/sysext/frontend/ext_tables.sql +++ b/typo3/sysext/frontend/ext_tables.sql @@ -106,7 +106,6 @@ CREATE TABLE tt_content ( target varchar(30) DEFAULT '' NOT NULL, recursive tinyint(3) unsigned DEFAULT '0' NOT NULL, imageheight mediumint(8) unsigned DEFAULT '0' NOT NULL, - pi_flexform mediumtext, accessibility_title varchar(30) DEFAULT '' NOT NULL, accessibility_bypass_text varchar(30) DEFAULT '' NOT NULL, category_field varchar(64) DEFAULT '' NOT NULL, diff --git a/typo3/sysext/impexp/Tests/Functional/Fixtures/ArrayAssertions/RenderPreviewImportPageAndRecordsByUpdateWithDiff.php b/typo3/sysext/impexp/Tests/Functional/Fixtures/ArrayAssertions/RenderPreviewImportPageAndRecordsByUpdateWithDiff.php index d0a50f5bc28fb5d3794e83364012abf567bc4b94..be5f466ea058e60f5d21b14928de053d814bcff0 100644 --- a/typo3/sysext/impexp/Tests/Functional/Fixtures/ArrayAssertions/RenderPreviewImportPageAndRecordsByUpdateWithDiff.php +++ b/typo3/sysext/impexp/Tests/Functional/Fixtures/ArrayAssertions/RenderPreviewImportPageAndRecordsByUpdateWithDiff.php @@ -134,6 +134,7 @@ return [ 'updateMode' => sprintf('<select class="form-select form-select-sm" name="tx_impexp[import_mode][sys_file_storage:1]" style="width: 100px"><option value="0">Update</option><option value="%s">Import as new</option><option value="%s">Ignore PID</option><option value="%s">Exclude</option></select>', \TYPO3\CMS\Impexp\Import::IMPORT_MODE_AS_NEW, \TYPO3\CMS\Impexp\Import::IMPORT_MODE_IGNORE_PID, \TYPO3\CMS\Impexp\Import::IMPORT_MODE_EXCLUDE), 'showDiffContent' => '<strong class="text-nowrap">[sys_file_storage:1 => 1]:</strong>' . "\n" . '<table class="table table-striped table-hover">' . "\n" + . '<tr><td>Is default storage? (is_default)</td><td><del>Yes</del><ins>No</ins></td></tr>' . "\n" . '<tr><td>Driver Configuration (configuration)</td><td>' . "\n\n" . '<del> \\n \\n \\n \\n fileadmin/\\n \\n \\n relative\\n \\n \\n 1\\n \\n \\n \\n \\n</del><ins>' . "\t\n" . "\t\t\n" @@ -151,7 +152,6 @@ return [ . "\t\t\n" . "\t\n" . '</ins></td></tr> -<tr><td>Is default storage? (is_default)</td><td><del>Yes</del><ins>No</ins></td></tr> <tr><td>Description (description)</td><td><strong>Field missing</strong> in database</td></tr> </table>', 'controls' => '', diff --git a/typo3/sysext/impexp/Tests/Functional/Fixtures/XmlExports/pages-and-ttcontent-with-corrupt-image.xml b/typo3/sysext/impexp/Tests/Functional/Fixtures/XmlExports/pages-and-ttcontent-with-corrupt-image.xml index e4c31d0b2fad809154ef183a643e917c05753823..f08177c8671d49d18c3111bafc6eb7c0c746ecc1 100644 --- a/typo3/sysext/impexp/Tests/Functional/Fixtures/XmlExports/pages-and-ttcontent-with-corrupt-image.xml +++ b/typo3/sysext/impexp/Tests/Functional/Fixtures/XmlExports/pages-and-ttcontent-with-corrupt-image.xml @@ -341,7 +341,12 @@ <field index="description" type="NULL"></field> <field index="name">fileadmin</field> <field index="driver">Local</field> - <field index="configuration"><?xml version="1.0" encoding="utf-8" standalone="yes" ?> + <field index="is_public">1</field> + <field index="is_browsable">1</field> + <field index="is_default">0</field> + <field index="is_writable">1</field> + <field index="is_online">1</field> + <field index="configuration"><?xml version="1.0" encoding="utf-8" standalone="yes" ?> <T3FlexForms> <data> <sheet index="sDEF"> @@ -359,11 +364,6 @@ </sheet> </data> </T3FlexForms></field> - <field index="is_public">1</field> - <field index="is_browsable">1</field> - <field index="is_default">0</field> - <field index="is_writable">1</field> - <field index="is_online">1</field> </fieldlist> <related index="rels" type="array"> <field index="configuration" type="array"> diff --git a/typo3/sysext/impexp/Tests/Functional/Fixtures/XmlExports/pages-and-ttcontent-with-image-but-not-included.xml b/typo3/sysext/impexp/Tests/Functional/Fixtures/XmlExports/pages-and-ttcontent-with-image-but-not-included.xml index 5de9725066184532e224816907be914404f245e5..dcad71503f10c40fef1432e82a5036fe425d108f 100644 --- a/typo3/sysext/impexp/Tests/Functional/Fixtures/XmlExports/pages-and-ttcontent-with-image-but-not-included.xml +++ b/typo3/sysext/impexp/Tests/Functional/Fixtures/XmlExports/pages-and-ttcontent-with-image-but-not-included.xml @@ -341,7 +341,12 @@ <field index="description" type="NULL"></field> <field index="name">fileadmin</field> <field index="driver">Local</field> - <field index="configuration"><?xml version="1.0" encoding="utf-8" standalone="yes" ?> + <field index="is_public">1</field> + <field index="is_browsable">1</field> + <field index="is_default">0</field> + <field index="is_writable">1</field> + <field index="is_online">1</field> + <field index="configuration"><?xml version="1.0" encoding="utf-8" standalone="yes" ?> <T3FlexForms> <data> <sheet index="sDEF"> @@ -359,11 +364,6 @@ </sheet> </data> </T3FlexForms></field> - <field index="is_public">1</field> - <field index="is_browsable">1</field> - <field index="is_default">0</field> - <field index="is_writable">1</field> - <field index="is_online">1</field> </fieldlist> <related index="rels" type="array"> <field index="configuration" type="array"> diff --git a/typo3/sysext/impexp/Tests/Functional/Fixtures/XmlExports/pages-and-ttcontent-with-image.xml b/typo3/sysext/impexp/Tests/Functional/Fixtures/XmlExports/pages-and-ttcontent-with-image.xml index ad922e962461d98b88ca51aec47ffbb261d5c03e..d115ed1c0d6d2c9809806746b112a742cb938cc4 100644 --- a/typo3/sysext/impexp/Tests/Functional/Fixtures/XmlExports/pages-and-ttcontent-with-image.xml +++ b/typo3/sysext/impexp/Tests/Functional/Fixtures/XmlExports/pages-and-ttcontent-with-image.xml @@ -341,7 +341,12 @@ <field index="description" type="NULL"></field> <field index="name">fileadmin</field> <field index="driver">Local</field> - <field index="configuration"><?xml version="1.0" encoding="utf-8" standalone="yes" ?> + <field index="is_public">1</field> + <field index="is_browsable">1</field> + <field index="is_default">0</field> + <field index="is_writable">1</field> + <field index="is_online">1</field> + <field index="configuration"><?xml version="1.0" encoding="utf-8" standalone="yes" ?> <T3FlexForms> <data> <sheet index="sDEF"> @@ -359,11 +364,6 @@ </sheet> </data> </T3FlexForms></field> - <field index="is_public">1</field> - <field index="is_browsable">1</field> - <field index="is_default">0</field> - <field index="is_writable">1</field> - <field index="is_online">1</field> </fieldlist> <related index="rels" type="array"> <field index="configuration" type="array">