I'm preparing one of my modules to run with Joomla 4, using the nightly builds. I encountering a problem I didn't have with 3.9. I'm calling the function setState on an article model and get the following exception:
"Call to a member function setState() on boolean"
The $appParams are not empty or anything. Code is also listed below, the line where the exception happens is marked.
// Get an instance of the generic articles model $model = JModelLegacy::getInstance('Articles', 'ContentModel', array('ignore_request' => true)); // This returns false instead of the model! // Set application parameters in model $app = JFactory::getApplication(); $appParams = $app->getParams(); $model->setState('params', $appParams); // Set the filters based on the module params $model->setState('filter.published', 1); $model->setState('filter.article_id', $articleIds); $model->setState('filter.category_id', $params['eventlist_categories']);
Did I oversee some deprecated function or so? Thanks for your help!
--- Edit ---
I have found that JModelLegacy::getInstance() returns false - so there's probably a new way of how to get the article model in Joomla! 4, right?