ContentModelArticle, JTableContent - which should be used to create articles?

Skip to first unread message

Michelle Martel

Aug 23, 2021, 3:54:52 PMAug 23
to Joomla! General Development

Hi, I am developing a plugin that loads data from an external source then creates articles.  Searching for information, I find some about ContentModelArticle and some about JTableContent.  References to ContentModelArticle are in the Joomla installer files, not JTableContentSo I thought ContentModelArticle was the right one, but  then I found (in the Joomla! Documentation) this entry:

JTableContent is the preferred method to add content to the database rather than with direct queries. JTableContent has many benefits which include simplifying the methods to create, read, update, and delete content

Which of these should be used to create articles when building an extension?  Or is there something else?

Hannes Papenberg

Aug 23, 2021, 4:03:53 PMAug 23
to Joomla! General Development
ContentModelArticle uses JTableContent to insert an article into the database. Basically, the later is the code to write an entry into the content table. The former also manages content history, tagging, plugin events, etc. What you want to use depends on your circumstances. If you simply want to insert a row into #__content, you can use the table class. If you need plugin events and all that, you use the model.

You received this message because you are subscribed to the Google Groups "Joomla! General Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To view this discussion on the web, visit

Michelle Martel

Aug 23, 2021, 4:08:53 PMAug 23
to Joomla! General Development
Thank you for the explanation!!
Reply all
Reply to author
0 new messages