APP-CLI-DOEXECUTE-001
class MyCli extends JApplicationCli
JApplicationCli is abstract — implement doExecute()
CliApplication (and WebApplication) are abstract in Joomla 4+. The entry point is doExecute(), not a custom execute() you invent.
class MyCli extends JApplicationCli → CliApplication + doExecute()
What you will see
- Cannot instantiate abstract class
- Class ... contains 1 abstract method and must therefore be declared abstract
Symptoms people search
CLI script abstract class · doExecute
Replace this code
Swap class MyCli extends JApplicationCli for CliApplication + doExecute().
Joomla 3
Remove or stop calling this
class LmsCli extends JApplicationCli {
public function execute() { /* old */ }
}Joomla 4 / 6
Use this instead
class LmsCli extends \Joomla\CMS\Application\CliApplication {
protected function doExecute(): void { /* your CLI work */ }
}How to fix it
- 1Implement protected doExecute().
- 2Do not instantiate CliApplication directly.
Also known as
doExecute · CliApplication abstract · JApplicationWeb abstract
Related issues
- Joomla 3 → 4Joomla API
JRequest::getVar() and the whole JRequest API
JRequest::getVar() → $app->getInput()->get('id')
- Joomla 3 → 4Joomla API
JError / JException
JError::raiseError() → throw new RuntimeException() / try-catch
- Joomla 3 → 4Joomla API
isAdmin() / isSite()
$app->isAdmin() → $app->isClient('administrator') / isClient('site')
- Joomla 3 → 4Joomla API
Factory::getUri()
JFactory::getUri() → Uri::getInstance()
- Joomla 3 → 4Joomla API
Factory::getXml() / JXMLElement
JFactory::getXML() → SimpleXMLElement
- Joomla 3 → 4Joomla API
Factory::getEditor()
JFactory::getEditor() → Editor::getInstance()