No Code Attached Yet
avatar leeroy1821
leeroy1821
2 Nov 2024

Steps to reproduce the issue

Make CLI app which create instance of ArticleModel: $article = \Joomla\CMS\Factory::getApplication()->bootComponent('com_content')->getMVCFactory()->createModel('Article', 'Administrator');

Expected result

I get model object

Actual result

[TypeError]                                                                                                          
  Joomla\CMS\Workflow\Workflow::__construct(): Argument #2 ($app) must be of type ?Joomla\CMS\Application\CMSApplication, Joomla\CMS\Application\ConsoleApplication given, called in ....../libraries/src/MVC/Model/WorkflowBehaviorTrait.php on line 90        

System information (as much as possible)

  • Joomla! 5.2.0
  • PHP 8.3

Additional comments

Problem is in \Joomla\CMS\Workflow\Workflow::__construct. Method is:
public function __construct(string $extension, ?CMSApplication $app = null, ?DatabaseDriver $db = null)
should be
public function __construct(string $extension, ?CMSApplicationInterface $app = null, ?DatabaseDriver $db = null)
because \Joomla\CMS\Application\CliApplication implements CMSApplicationInterface, not extends CMSApplication.

avatar leeroy1821 leeroy1821 - open - 2 Nov 2024
avatar joomla-cms-bot joomla-cms-bot - change - 2 Nov 2024
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 2 Nov 2024
avatar alikon alikon - change - 2 Nov 2024
Status New Closed
Closed_Date 0000-00-00 00:00:00 2024-11-02 09:47:23
Closed_By alikon
avatar alikon alikon - close - 2 Nov 2024
avatar alikon
alikon - comment - 2 Nov 2024

thanks for reporting follow #40653

Add a Comment

Login with GitHub to post a comment