No Code Attached Yet
avatar Elfangor93
Elfangor93
6 Sep 2025

Steps to reproduce the issue

  • Install fresh Joomla installation
  • Install component with the following specialities
    • Installing default content during installation using Table classes
    • Implementing own MVCFactoryProvider

Expected result

Installation successful

Actual result

PHP Error Class "Example\Component\Example\Administrator\MVC\MVCFactoryProvider" not found

System information (as much as possible)

  • Joomla! 6.0.0-beta3-dev
  • PHP version 8.3.14
  • MySQL version 9.1.0

Additional comments

If you have an extension with a custom MVCFactoryProvider, then the fully qualified class name including namespace is not available during installation. This means $app->bootComponent('com_mycomponent')->getMVCFactory()->createModel(...) does not work during postflight in the installation script.
Apparently there are core Plugins like Behaviour - Versionable who are loading the MVCFactory and are called when a Table is stored. I use Tables to install default content during component installation.

To reproduce the error you can use the JoomGallery extension:
https://github.com/JoomGalleryfriends/JoomGallery/actions/runs/17437007533/artifacts/3917471538

avatar Elfangor93 Elfangor93 - open - 6 Sep 2025
avatar joomla-cms-bot joomla-cms-bot - change - 6 Sep 2025
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 6 Sep 2025
avatar Elfangor93 Elfangor93 - change - 6 Sep 2025
The description was changed
avatar Elfangor93 Elfangor93 - edited - 6 Sep 2025
avatar rdeutz
rdeutz - comment - 7 Sep 2025

Could you post the full error stack, please.

avatar Fedik
Fedik - comment - 7 Sep 2025

You trying to run the code before the installations is finished and before namespace map is updated.
The new namespace map going to be available on next after installation request.

If you really want it during installation then you have to do registration manually. The installer cannot do it on its own for many reasons.

avatar Elfangor93
Elfangor93 - comment - 8 Sep 2025

An error has occurred.

0 Class "Joomgallery\Component\Joomgallery\Administrator\MVC\MVCFactoryProvider" not found

Call Stack

# Function Location
1 () JROOT\administrator\components\com_joomgallery\services\provider.php:50
2 Joomla\DI\ServiceProviderInterface@anonymousC:\wamp64\www\j6jg4-dev\administrator\components\com_joomgallery\services\provider.php:37$b1f->register() JROOT\libraries\src\Extension\ExtensionManagerTrait.php:145
3 Joomla\CMS\Application\CMSApplication->loadExtension() JROOT\libraries\src\Extension\ExtensionManagerTrait.php:51
4 Joomla\CMS\Application\CMSApplication->bootComponent() JROOT\plugins\behaviour\versionable\src\Extension\Versionable.php:110
5 Joomla\Plugin\Behaviour\Versionable\Extension\Versionable->onTableAfterStore() JROOT\libraries\vendor\joomla\event\src\Dispatcher.php:454
6 Joomla\Event\Dispatcher->dispatch() JROOT\libraries\src\Table\Nested.php:858
7 Joomla\CMS\Table\Nested->store() JROOT\administrator\components\com_joomgallery\src\Table\MultipleAssetsTable.php:114
8 Joomgallery\Component\Joomgallery\Administrator\Table\MultipleAssetsTable->store() JROOT\administrator\components\com_joomgallery\src\Table\CategoryTable.php:312
9 Joomgallery\Component\Joomgallery\Administrator\Table\CategoryTable->store() JROOT\tmp\joomgallery\script.php:666
10 com_joomgalleryInstallerScript->addDefaultCategory() JROOT\tmp\joomgallery\script.php:454
11 com_joomgalleryInstallerScript->postflight() JROOT\libraries\src\Installer\LegacyInstallerScript.php:159
12 Joomla\CMS\Installer\LegacyInstallerScript->__call() JROOT\libraries\src\Installer\LegacyInstallerScript.php:188
13 Joomla\CMS\Installer\LegacyInstallerScript->callOnScript() JROOT\libraries\src\Installer\LegacyInstallerScript.php:114
14 Joomla\CMS\Installer\LegacyInstallerScript->postflight() JROOT\libraries\src\Installer\InstallerAdapter.php:1064
15 Joomla\CMS\Installer\InstallerAdapter->triggerManifestScript() JROOT\libraries\src\Installer\InstallerAdapter.php:802
16 Joomla\CMS\Installer\InstallerAdapter->install() JROOT\libraries\src\Installer\Installer.php:688
17 Joomla\CMS\Installer\Installer->install() JROOT\administrator\components\com_installer\src\Model\InstallModel.php:215
18 Joomla\Component\Installer\Administrator\Model\InstallModel->install() JROOT\administrator\components\com_installer\src\Controller\InstallController.php:52
19 Joomla\Component\Installer\Administrator\Controller\InstallController->install() JROOT\libraries\src\MVC\Controller\BaseController.php:730
20 Joomla\CMS\MVC\Controller\BaseController->execute() JROOT\libraries\src\Dispatcher\ComponentDispatcher.php:143
21 Joomla\CMS\Dispatcher\ComponentDispatcher->dispatch() JROOT\libraries\src\Component\ComponentHelper.php:361
22 Joomla\CMS\Component\ComponentHelper::renderComponent() JROOT\libraries\src\Application\AdministratorApplication.php:150
23 Joomla\CMS\Application\AdministratorApplication->dispatch() JROOT\libraries\src\Application\AdministratorApplication.php:205
24 Joomla\CMS\Application\AdministratorApplication->doExecute() JROOT\libraries\src\Application\CMSApplication.php:315
25 Joomla\CMS\Application\CMSApplication->execute() JROOT\administrator\includes\app.php:58
26 require_once() JROOT\administrator\index.php:32
avatar Elfangor93
Elfangor93 - comment - 8 Sep 2025

Based on the call stack, you can see that the error is thrown at

$this->getDispatcher()->dispatch('onTableAfterStore', $event);

The plugin which is in the end causing the error is the plg_behaviour_versionable as it tries to boot the component which is currently being installed.

$model = $this->getApplication()->bootComponent($component)->getMVCFactory()->createModel($modelName, 'Administrator');

During the booting the custom MVCFactoryProvider is not found because the namespace of this component is not yet available.

This all leads to the fact that installing default content using the table classes is not possible anymore in Joomla! 6 within the postflight method of the installation.

avatar Elfangor93 Elfangor93 - change - 8 Sep 2025
The description was changed
avatar Elfangor93 Elfangor93 - edited - 8 Sep 2025
avatar Elfangor93
Elfangor93 - comment - 23 Oct 2025

Only workaround for this issue currently is to deactivate the Plugin for the duration of the installation of these extensions and then reactivate it after installation.

avatar joomdonation
joomdonation - comment - 23 Oct 2025

@Elfangor93 Did you try to register namespace for your component before calling the code as a workaround? See https://github.com/joomla/joomla-cms/blob/6.0-dev/libraries/namespacemap.php#L106-L110 to get idea about how to register namespace

But the check here is not needed and I would remove it.

avatar Elfangor93
Elfangor93 - comment - 23 Oct 2025

But the check here is not needed and I would remove it.

For me it also does not make sense to check the model in a plugin event triggered in a table class. If we have to do that, then there is not good architecture present in the code or do I misunderstand something?

avatar joomdonation
joomdonation - comment - 23 Oct 2025

This code is a leftover from the initial implementation of the new version history feature.
At first, VersionableModelInterface only supported creating version records but not deleting them.
As a result, this check was necessary to prevent version records from being created twice — once by the model and once by the version history plugin.

After my PR #46268 , both saving and deleting are handled by VersionableModelInterface. Therefore, extensions using VersionableModelInterface can update their Table classes to remove implements VersionableTableInterface, and this code is no longer required.

In short, I think we should remove the check.

avatar Elfangor93
Elfangor93 - comment - 23 Oct 2025

@joomdonation Do you want me to do the PR or can you do it?

avatar joomdonation
joomdonation - comment - 23 Oct 2025

@Elfangor93 Would be great if you can do it :).

avatar Elfangor93
Elfangor93 - comment - 23 Oct 2025

pointing towards the 6.0-dev branch I guess..

avatar Elfangor93 Elfangor93 - change - 23 Oct 2025
Status New Closed
Closed_Date 0000-00-00 00:00:00 2025-10-23 17:24:03
Closed_By Elfangor93
avatar Elfangor93 Elfangor93 - close - 23 Oct 2025
avatar Elfangor93
Elfangor93 - comment - 23 Oct 2025

Close, because PR created.

Add a Comment

Login with GitHub to post a comment