TYPO3 Migration: Von gridelementsteam/gridelements nach b13/container

TYPO3 Migration: Von gridelementsteam/gridelements nach b13/container

Es gibt bereits einige Blogposts oder Beiträge die eine Migration von gridelements nach container zeigen. Wir haben unser Migrationsframework in2code/migration nun um 2 PropertyHelper erweitert, die euch das Leben erleichtern können.

Mit der Version 9 von in2code/migration habt ihr nun die Möglichkeit automatisch von gridelementsteam/gridelements nach b13/container zu migrieren. Und wie immer gilt beim Einsatz von in2code/migration, dass man wissen sollte welche Daten von welchem Tabellenfeld in welches übertragen werden sollen. Das haben wir schon mal für euch gemacht und auf unserem Whiteboard aufgemalt. Im Prinzip dreht sich alles um die Tabelle tt_content und die Inhalte darin:

Ihr müsst also wissen, wie die Layouts (vorher tt_content.tx_gridelements_backend_layout und nachher tt_content.CType) heißen. Darüber hinaus sollten ihr auch wissen, wie die Columns migriert werden sollen (vorher tt_content.tx_gridelements_columns und nachher tt_content.colPos). Das packt ihr in eure ContentMigration mit Hilfe zweier neuer PropertyHelper Klassen. Das Ganze kann dann z.B. so in ContentMigrator.php aussehen:

<?php declare(strict_types=1); namespace In2code\MigrationExtend\Migration\Migrator; use In2code\Migration\Migration\Migrator\AbstractMigrator; use In2code\Migration\Migration\Migrator\MigratorInterface; use In2code\Migration\Migration\PropertyHelpers\GridelementsToContainerChildrenPropertyHelper; use In2code\Migration\Migration\PropertyHelpers\GridelementsToContainerParentPropertyHelper; /** * Class ContentMigrator */ class ContentMigrator extends AbstractMigrator implements MigratorInterface { /** * @var string */ protected $tableName = 'tt_content'; /** * @var array */ protected $propertyHelpers = [ '_dummy' => [ [ 'className' => GridelementsToContainerParentPropertyHelper::class, 'configuration' => [ 'types' => [ // tt_content.tx_gridelements_backend_layout => tt_content.CType 1 => 'container-50-50', 3 => 'container-33-33-33', 4 => 'container-70-30', 5 => 'container-30-70', 10 => 'container-accordion', 11 => 'container-tab', 12 => 'container-container', ], ], ], [ 'className' => GridelementsToContainerChildrenPropertyHelper::class, 'configuration' => [ 'columns' => [ // old value in tt_content.tx_gridelements_backend_layout 1 => [ // tt_content.tx_gridelements_columns => tt_content.colPos 12 => 12, 22 => 22, ], 3 => [ 1 => 12, 2 => 22, 3 => 32, ], 4 => [ 1 => 12, 2 => 22, ], 5 => [ 1 => 12, 2 => 22, ], 10 => [ 0 => 12, ], 11 => [ 0 => 12, ], 12 => [ 0 => 12, ], ], ], ], ], ]; }

So würde dann die Konfigurationsdatei Migration.php aussehen:

<?php return [ // Default values if not given from CLI 'configuration' => [ 'key' => '', 'dryrun' => true, 'limitToRecord' => null, 'limitToPage' => 0, 'recursive' => true ], // Define your migrations 'migrations' => [ [ 'className' => \In2code\MigrationExtend\Migration\Migrator\ContentMigrator::class, 'keys' => [ 'content', ] ], ] ];

Und danach könnt ihr die Migration wie gewohnt über die CLI starten:

./vendor/bin/typo3cms migration:migrate --configuration EXT:migration_extend/Configuration/Migration.php --key content --dryrun 0

Viel Spaß beim Migrieren

P.S.: Wenn ihr nach der Migration im Backend die Fehlermeldung "Unused elements detected on this page" erhaltet, hiflt der Aufruf des Comands container:fixContainerParentForConnectedModeCommand

Alexander Kellner

Alex Kellner

Alex Kellner ist nicht nur für seine vielen TYPO3-Erweiterungen wie zum Beispiel powermail, femanager oder lux sondern auch für seinen Community-Einsatz bekannt. Er gibt auch gerne Administrations- oder Entwicklungsschulungen oder Worksshops.

Alexander Kellner  |  Geschäftsführung & COO

TYPO3: Finding pages in mixed mode

In TYPO3, Mixed Mode refers to translated pages that contain content only partially related to the corresponding content in the main language. This is indicated in the backend by an error message. But...

Zum Beitrag

Extbase Extensions: Think extensibility with data, site and language

Today, I have a small request for the TYPO3 extension authors out there: Make sure your extensions are extensible. This will also promote the distribution of the corresponding plugins.

Zum Beitrag

SQL: Show all tables sorted by size in descending order

Lately I've been using the SQL command more often to find out which tables in the TYPO3 database are the largest. I've published the snippet once.

Zum Beitrag

TYPO3 12 with CKEditor 5: Styles in a single selection

If you set a link in the RTE in TYPO3, you may have to choose between different link classes, for example to create buttons in the frontend. What's new in TYPO3 12 is that you can select not just one...

Zum Beitrag

Null-Safe Operator in the TYPO3 area

With the introduction of PHP8, problems with undefined arrays or variables in general can arise in many places. Here are a few examples and simple solutions.

Zum Beitrag

Delete the first/last lines of a (SQL) file

There isn't much to say about the following commands. Sometimes it can be useful to delete the first (or last) X lines from a file. And if the file is too large to open with a conventional program, a...

Zum Beitrag