forkcms icon indicating copy to clipboard operation
forkcms copied to clipboard

Exception when creating entities during Module install

Open davysumo opened this issue 1 year ago • 1 comments

Bug Report

Q A
Critical Bug no
Version 6.x.x

Problem description

The method this->createTableForEntities(...) crashes in ModuleInstaller for optional modules (the modules that are installed during fork installation seem to install just fine.)

Exception:

"Handling "ForkCMS\Modules\Extensions\Domain\Module\Command\InstallModules" failed: The class 'ForkCMS\Modules\ContentBlocks\Domain\ContentBlock\ContentBlock' was not found in the chain configured namespaces ForkCMS\Modules\Pages\Domain, ForkCMS\Modules\Internationalisation\Domain, ForkCMS\Modules\Frontend\Domain, ForkCMS\Modules\Extensions\Domain, ForkCMS\Modules\BlockEditor\Domain, ForkCMS\Modules\Backend\Domain"

Relevant stack trace:

"TraceableMessageBus->dispatch() in src/Modules/Extensions/Backend/Actions/ModuleInstall.php (line 32)

                $this->header->addFlashMessage(FlashMessage::error('NotFound'));
                return new RedirectResponse(ModuleIndex::getActionSlug()->generateRoute($this->router));
            },
            validCallback: function (FormInterface $form): RedirectResponse {
                $this->commandBus->dispatch(new InstallModules(ModuleName::fromString($form->getData()['id'])));
                return new RedirectResponse(ModuleIndex::getActionSlug()->generateRoute($this->router));
            },
            flashMessageCallback: function (FormInterface $form): FlashMessage {
                return FlashMessage::success('ModuleInstalled', ['%module%' => $form->getData()['id']]);

ModuleInstall->ForkCMS\Modules\Extensions\Backend\Actions{closure}() in src/Modules/Backend/Domain/Action/AbstractFormActionController.php (line 90)

AbstractFormActionController->handleForm() in src/Modules/Extensions/Backend/Actions/ModuleInstall.php (line 22)

ModuleInstall->getFormResponse() in src/Modules/Backend/Domain/Action/AbstractFormActionController.php (line 52)"

Steps to reproduce

Reproduce by installing ContentBlocks from https://github.com/forkcms/forkcms/pull/3555

Expected behavior / Proposed solution

I suspect this broke in https://github.com/forkcms/forkcms/commit/1af2d77a627e258eba1615874b4a45fc3e9ece6b or any of the commits on Sep 28, since before this was working.

davysumo avatar Oct 25 '23 13:10 davysumo

@davysumo is this still an issue? I seem to remember that your entity was final originally, that might have caused the problem

carakas avatar Nov 24 '23 22:11 carakas