Bug #90780

Custom Doktypes / Translation / pages recursive

Added by varioous OG 7 months ago.

Status:
New
Priority:
Should have
Assignee:
-
Category:
Extbase
Target version:
-
Start date:
2020-03-18
Due date:
% Done:

0%

TYPO3 Version:
9
PHP Version:
7.3
Tags:
Complexity:
nightmare
Is Regression:
Sprint Focus:

Description

Hello,

we are migrating a website from TYPO3 8 to 9. I use custom Doktypes and translations (German, Italian, French).

Following Page-Types:
  • Wine-Object
  • Winevintage-Object

Winevintage-Object is linked to Wine-Object by pid.

TCA-Override of pages.php:

'vintages' => [
        'exclude' => 1,
        'label' => 'Jahrgänge',
        'config' => [
            'type' => 'inline',
            'foreign_table' => 'pages',
            'foreign_field' => 'pid',
            'appearance' => [
               ......
            ]
        ],
    ],

Now after migration when I) fetch the wine object ) have in the ObjectStorage of the wine 3 Vintage-Objects (for German, Italian and France). I have done the migration and in the pages table everything look good (https://docs.typo3.org/c/typo3/cms-core/master/en-us/Changelog/9.0/Important-82445-MigratePagesLanguageOverlayIntoPages.html).

Wine-Model:

<?php

class Wine extends BasicPage
{

    /**
     * __construct
     */
    public function __construct()
    {
        parent::__construct();
        $this->initStorageObjects();
    }

    /**
     * Initializes all ObjectStorage properties
     * Do not modify this method!
     * It will be rewritten on each save in the extension builder
     * You may modify the constructor of this class instead
     *
     * @return void
     */
    protected function initStorageObjects()
    {
        $this->vintages = new ObjectStorage();
    }

    /**
     * vintages
     *
     * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\Varioous\VaAldivinoteca\Domain\Model\Winevintage>
     */
    protected $vintages;

    /**
     * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage
     */
    public function getVintages()
    {
        return $this->vintages;
    }

    /**
     * @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage $vintages
     */
    public function setVintages(ObjectStorage $vintages)
    {
        $this->vintages = $vintages;
    }
}


Winevintage-Model:
class Winevintage extends BasicPage
{

    /**
     * wine
     *
     * @var \Varioous\VaAldivinoteca\Domain\Model\Wine
     */
    protected $wine = null;

    /**
     * @return \Varioous\VaAldivinoteca\Domain\Model\Wine
     */
    public function getWine()
    {
        return $this->wine;
    }

    /**
     * @param \Varioous\VaAldivinoteca\Domain\Model\Wine $wine
     */
    public function setWine(\Varioous\VaAldivinoteca\Domain\Model\Wine $wine)
    {
        $this->wine = $wine;
    }
}

Table-Mapping:

# map pages and winevintage
config.tx_extbase.persistence.classes {
    Varioous\VaAldivinoteca\Domain\Model\Winevintage {
        mapping {
            recordType = \Varioous\VaAldivinoteca\Domain\Model\Winevintage
            tableName = pages
        }
    }

}

# map pages and wine
config.tx_extbase {
    persistence {
        classes {
            Varioous\VaAldivinoteca\Domain\Model\Wine {
                mapping {
                    recordType < module.tx_vaaldivinoteca.settings.doktypes.wine
                    tableName = pages
                    columns {
                        crdate.mapOnProperty = crdate
                    }
                }
            }
        }
    }
}

Now I fetch the wine-object ... and it has 3 items in the object storage (see attached image). It should be one (before the update in TYPO3 8 I only got the correct one with the correct language).

Current workaround:

            'type' => 'inline',
            'foreign_table' => 'pages',
            'foreign_field' => 'pid',
            'foreign_match_fields' => [
              'sys_language_uid' => '###REC_FIELD_sys_language_uid###',
            ],

Kind regards,
Harald

pages.png View (41.1 KB) varioous OG, 2020-03-18 15:52

image (1).png View (50.9 KB) varioous OG, 2020-03-18 15:59

Also available in: Atom PDF