简体   繁体   English

TYPO3 v10 迁移具有不起作用的属性的 config.persistence.classes

[英]TYPO3 v10 Migration of config.persistence.classes with properties not working

I'm currently upgrading from TYPO3 9 to 10 and already changed the persitence mapping like it is descriped here: https://docs.typo3.org/c/typo3/cms-core/main/en-us/Changelog/10.0/Breaking-87623-ReplaceConfigpersistenceclassesTyposcriptConfiguration.html我目前正在从 TYPO3 9 升级到 10,并且已经像这里描述的那样更改了持久性映射: https ://docs.typo3.org/c/typo3/cms-core/main/en-us/Changelog/10.0/ Breaking-87623-ReplaceConfigpersistenceclassesTyposcriptConfiguration.html

The mapping of the model through the tablename works fine, however the columns are not mapped.通过表名映射模型工作正常,但未映射列。 All fields are null except the uid.除 uid 外,所有字段均为空。

Old Mapping:旧映射:

WS\Shop\Domain\Model\Booking { 
    mapping { 
        tableName = tx_cart_domain_model_checkout 
        columns { 
            uuid.mapOnProperty = uuid 
            creation_timestamp.mapOnProperty = creationTimestamp
            lastedit_timestamp.mapOnProperty = lasteditTimestamp 
            ...
        } 
    } 
}

New Mapping:新映射:

<?php
declare(strict_types = 1);

return [
    \WS\Shop\Domain\Model\Booking::class => [
        'tableName' => 'tx_cart_domain_model_checkout',
        'properties' => [
            'uuid' => [
                'fieldName' => 'uuid'
            ],
            'creationTimestamp' => [
                'fieldName' => 'creation_timestamp'
            ],
            'lasteditTimestamp' => [
                'fieldName' => 'lastedit_timestamp'
            ],
            ...
        ],
    ]
];

After debugging DataMapFactory.php I found out that you have to create a TCA file for the table (in my case tx_cart_domain_model_checkout.php ):调试DataMapFactory.php后,我发现您必须为表创建一个 TCA 文件(在我的例子中为 tx_cart_domain_model_checkout.php ):

<?php
return [
    'columns' => [
        'uuid' => [],
        'creation_timestamp' => [],
        'lastedit_timestamp' => []

    ]
];

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM