1

i'm trying to upgrade a extension for TYPO3 10.4 which add a custom type to tx_news (Doc).

I did the migration based on this example: Breaking: #87623

Classes/Controller/NewsController.php

return [
  \Xyz\Extendnews\Domain\Model\Team::class => [
    'tableName' => 'tx_news_domain_model_news',
    'recordType' => 3,
],

But wenn I debug the entry in the Fluid-Template the default model is still used.

Did I miss something or does someone have a working example.

Thanks for any help.


Update: I want to create a new type, explained in Georg Ringer´s manual

I have created a small extension, everything works fine with TYPO3 9.5, but not with TYPO3 10.4. DEMO EXT

With TYPO3 10.4 the prototype is not MxnTeam\Domain\Model\Team


Update 29.06.2020:

tobenschmidt from the TYPO3 Slack channel ( post ) help me out.

return [
 \Mexan\MxnTeam\Domain\Model\Team::class => [
     'tableName' => 'tx_news_domain_model_news',
     'recordType' => \Mexan\MxnTeam\Domain\Model\Team::class,
 ],
 \Mexan\MxnTeam\Domain\Model\Client::class => [
     'tableName' => 'tx_news_domain_model_news',
     'recordType' => \Mexan\MxnTeam\Domain\Model\Client::class,
 ],
 \GeorgRinger\News\Domain\Model\News::class => [
     'tableName' => 'tx_news_domain_model_news',
     //'recordType' => 0,
     'subclasses' => [
         \Mexan\MxnTeam\Domain\Model\Team::class,
         \Mexan\MxnTeam\Domain\Model\Client::class,
     ]
 ],
];

This works fine, even with 2 custom types. but unfortunately the default news are no longer loaded but if I add recordType => 0, then only normal news and my custom types are visible, but not the type 1 and 2 (Internal and external)

I updated the extension: mxn_team

is there a way to prevent this?

Megafry
  • 84
  • 1
  • 5
  • _recordType_ is just a row in the news table which is used for filtering the records. All extensions that share the same news records should use the same record type string. Maybe you have to update the DB table manually to comply with this. – rantanplan Oct 18 '20 at 23:20

2 Answers2

3

This works for me...

Implement your news type as described in https://docs.typo3.org/p/georgringer/news/8.5/en-us/DeveloperManual/ExtendNews/AddCustomType/Index.html

but instead of the described TypoScript add following file to your extension:

ext_name/Configuration/Extbase/Persistence/Classes.php

<?php

return [
    \GeorgRinger\News\Domain\Model\News::class => [
        'subclasses' => [
            3 => \Vendor\ExtName\Domain\Model\MyCustomNewsType::class
        ]
    ],
    Vendor\ExtName\Domain\Model\MyCustomNewsType::class => [
        'tableName' => 'tx_news_domain_model_news',
        'recordType' => 3,
    ],
];

The way using TypoScript (config.tx_extbase.persistence.classes) was removed in TYPO3 v10

rfritzzz
  • 31
  • 4
  • The Problem with the example "Update 29.06.2020" are the missing type numbers, I think. `'subclasses' => [ 3 => \Mexan\MxnTeam\Domain\Model\Team::class, 4 => \Mexan\MxnTeam\Domain\Model\Client::class, ]` – rfritzzz Nov 08 '20 at 16:11
0

You write "Classes/Controller/NewsController.php" but you have to create a file here

extendnews/Configuration/Extbase/Persistence/Classes.php

and put your code in there. After that, do not forget to clear all cache. Complete file "Classes.php" should look like

<?php
declare(strict_types = 1);

return [
  \Xyz\Extendnews\Domain\Model\Team::class => [
    'tableName' => 'tx_news_domain_model_news',
    'recordType' => \Xyz\Extendnews\Domain\Model\Team::class,
],

To use the new model follow Georg Ringer´s manual manual on typo3.org

And a working example here

G-Agnes
  • 66
  • 8
  • Thank you for your help, I don't want to expand the news, I want to create a new type, explained in Georg Ringer´s [manual][1] I have created a small extension, everything works fine with TYPO3 9.5, but not with TYPO3 10.4. [DEMO EXT][2] With TYPO3 10.4 the prototype is not MxnTeam\Domain\Model\Team [1]: https://docs.typo3.org/p/georgringer/news/8.3/en-us/DeveloperManual/ExtendNews/AddCustomType/Index.html [2]: https://github.com/Megafry/mxn_team – Megafry Jun 26 '20 at 12:03