use Joomla\CMS\Factory;
use Joomla\CMS\Table\Table;
$table = Table::getInstance('Content', 'JTable');
$data = array();
$data['title'] = "something";
$data['alias'] = "something";
$data['state'] = 1;
$data['catid'] = 1;
.....
// Bind data
if (!$table->bind($data)) {
throw new Exception($table->getError());
}
// Save Article
if (!$table->store()) {
throw new Exception($table->getError());
}
The article should be saved in the #__content table and viewable from the admin backend.
The article is saved to the #__content table. The #__assets table appear to be populated correctly. However, the article IS NOT visible in the admin backend.
Joomla 4.0.0-rc4
Title |
|
Closing this issue is not something with Joomla core but with your own code and there is suggested code above. Feel free to re-open if the above answer does not solve your issue.
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2021-08-22 11:39:55 |
Closed_By | ⇒ | joomdonation | |
Labels |
Added:
No Code Attached Yet
Removed: ? |
The code you are using is not recommended/standard way to save an item. What you should do is create model object and use save method to save the object.
Sample code https://github.com/joomla/joomla-cms/blob/4.0-dev/administrator/components/com_categories/src/Helper/CategoriesHelper.php#L97
For your case, create article, you can try this (not tested):