I guess I should have written "dearth" instead.Paucity
In any case, I have been able to retrieve an article using
$app = Factory::getApplication();
$factory = $app->bootComponent('com_content')->getMVCFactory();
$model = $factory->createModel('Article');
$article = $model->getItem($articleId);
at that point I have some code that modifies the introtext (never mind the details) in the $article object (array?) and I'm ready to write the updated introtext back. I tried using
$model->save($article);
but that causes an error:
0 Call to undefined method Joomla\Component\Content\Site\Model\ArticleModel::save()
I would guess that I need to add another "use" directive because the save function/method only exists in the administrator version of com_content. OR, perhaps, it is just not possible to use save() at all?
I'd be happy with know where I could find this info, but delighted if somebody could tell me how I should be doing this.
Statistics: Posted by davidascher — Sat Oct 26, 2024 8:28 pm