I have just upgraded my site from Joomla 3.7 to 3.9 and I am getting errors related to my code for a component model class that extends an administrator component model class. The require_once
line below was fine in Joomla 3.7. I replaced it with JLoader::import
, but no luck.
Is the JPATH_COMPONENT_ADMINISTRATOR
constant no longer valid in Joomla 3.9?
The error I'm getting is:
PHP Fatal error: Class 'NoDiceModelWidget' not found in C:\xampp\htdocs\nodice\components\com_nodice\models\widget.php on line 8
The import should be looking in C:\xampp\htdocs\nodice\administrator\components\com_nodice\models.
How can I import my administrator model to extend my front-end model?
<?php
defined('_JEXEC') or die;
//require_once JPATH_COMPONENT_ADMINISTRATOR.'/models/widget.php';
JLoader::import(JPATH_COMPONENT_ADMINISTRATOR.'/models/widget.php');
class NoDiceModelAuthorWidget extends NoDiceModelWidget
{
public function __construct($config = array())
{
parent::__construct($config);
}
}