Does TYPO3 Extbase extend an existing extension to use the native extension model?

I'm trying to extend an extension (news) with three additional "Date" fields (timestamp) and want to name them in my current file (news).

I have hooked everything up so far so that I can see my extra fields in the backend without choosing an extratype - for that I had modpedied ext_tables.php and could save data.

Now I was trying to use this field in my news feed using the following code in my Partials / List / Item.html - {newsItem.datetime}

I guess I need to adjust to typoscript that now Model Tx_News_Domain_Model_News

config.tx_extbase{
    persistence{
        classes{
            Tx_News_Domain_Model_News {
                className = MyVendor\MyNews\Domain\Model\New
            }

            MyVendor\MyNews\Domain\Model\News {
                mapping {
                    tableName = tx_news_domain_model_news
                    recordType = Tx_MyNews_News
                }
            }
        }
    }    
}

      

But that doesn't seem to work - anyone with a solution.

+3


source to share


1 answer


First of all, you don't have to extend EXT: news "the usual Extbase way". EXT: news offers the ability to expand with additional fields without redefining your model. This is documented here .

The advantage of this method is that multiple extensions can still distribute news without conflicts.

If you still want to do it your own way, you need to fix the configuration as follows:

plugin.tx_news {
  objects {
     Tx_News_Domain_Domain_News {
        className = My\Extension\Domain\Model\News
     }
  }
}

      



This tells Extbase to use the model class instead of the news model class.

config.tx_extbase.persistence.classes {
    Visol\Newscatinvite\Domain\Model\News {
        mapping {
            tableName = tx_news_domain_model_news
        }
    }
}

      

This tells Extbase to use the news table for your model.

Never forget to clear all system caches (the class reflection is stored in the database). You have "system flash caches" in the Backend if you're in a development context.

+3


source







All Articles