0

I've got a custom component I've written which has a task that needs to be run every evening. I'm using JApplicationCli but I can't get it to work.

From searching on the web I've found a suggestion to use renderComponent like this:

class myCli extends JApplicationCli
{
    public function doExecute()
    {    
        $app = JFactory::getApplication('site');
        $app->input->set('task', 'myController.myTask');
        $component = Joomla\CMS\Component\ComponentHelper::renderComponent('com_myComponent');
    }
}

The problem I'm having is when my code tries to get an instance of another component it gets back false: $vmuser = JModelLegacy::getInstance('User','VirtueMartModel');

This works when I run it as a normal web request but not from the cli.

2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.