Installation successful
PHP Error Class "Example\Component\Example\Administrator\MVC\MVCFactoryProvider" not found
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
| Labels |
Added:
No Code Attached Yet
|
||
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.
0 Class "Joomgallery\Component\Joomgallery\Administrator\MVC\MVCFactoryProvider" not found
| # | 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 |
Based on the call stack, you can see that the error is thrown at
joomla-cms/libraries/src/Table/Nested.php
Line 858 in e3de1e4
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.
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.
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.
@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.
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?
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.
@joomdonation Do you want me to do the PR or can you do it?
@Elfangor93 Would be great if you can do it :).
pointing towards the 6.0-dev branch I guess..
| Status | New | ⇒ | Closed |
| Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2025-10-23 17:24:03 |
| Closed_By | ⇒ | Elfangor93 |
Close, because PR created.
Could you post the full error stack, please.