1

I am adapting the component to the new structure and classes of joomla 4. I started with the admin panel of my component. The list and the edit page are displayed without errors, but when I try to use any toolbar buttons, I get a message.

Call to a member function getTable() on bool

Call stack
#   Function --- Location
1   () --- JROOT/libraries/src/MVC/Controller/FormController.php:307
2   Joomla\CMS\MVC\Controller\FormController->cancel() ---JROOT/libraries/src/MVC/Controller/BaseController.php:730
3   Joomla\CMS\MVC\Controller\BaseController->execute() --- JROOT/libraries/src/Dispatcher/ComponentDispatcher.php:146
4   Joomla\CMS\Dispatcher\ComponentDispatcher->dispatch() ---JROOT/libraries/src/Component/ComponentHelper.php:389
5   Joomla\CMS\Component\ComponentHelper::renderComponent() --- JROOT/libraries/src/Application/AdministratorApplication.php:143
6   Joomla\CMS\Application\AdministratorApplication->dispatch() --- JROOT/libraries/src/Application/AdministratorApplication.php:186
7   Joomla\CMS\Application\AdministratorApplication->doExecute() --- JROOT/libraries/src/Application/CMSApplication.php:278
8   Joomla\CMS\Application\CMSApplication->execute() --- JROOT/administrator/includes/app.php:63
9   require_once() --- JROOT/administrator/index.php:32

The controller is triggered, so is the model. The model has a getTable() function. Theoretically, everything works, but when 'save', 'closing', or 'save and close', I get the same error. At the same time, the chain of methods does not reach the component model.

JROOT/libraries/src/MVC/Controller/FormController has no access (or connection) to my model.
The path to the model is administrator/components/com_mycom/src/Model/NameModel.php. I don't understand what the reason is.

0

1 Answer 1

2

The solution has been found. My controller contained a __construct() function of this type:

class MyviewnameController extends FormController
{
    function __construct( $config = array() )
    {
        $this->view_list = 'list';
        parent::__construct( $config );
    }
}

I looked at the com_content component controller and saw that now __construct() contains additional parameters and added them. My problem was solved immediately.

class MyviewnameController extends FormController
{
    public function __construct($config=array(), MVCFactoryInterface $factory=null, $app=null, $input=null)
    {
        parent::__construct($config, $factory, $app, $input);

        $this->view_list = 'list';
    }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.