Uploaded image for project: 'eZ Platform Enterprise Edition'
  1. eZ Platform Enterprise Edition
  2. EZEE-3487

Database installer is using the default Doctrine connection

    XMLWordPrintable

Details

    Description

      Looks like our database installers for DXP do not use the correct Doctrine connection in all places - even when the default siteaccess has a different Doctrine connection specified the default connection is used.

      Steps to reproduce:
      1. In config/packages/doctrine.yaml define a new database connection and break the default one:

      doctrine:
           dbal:
                default_connection: default
                connections:
                     default:
                          url: 'mysql://INVALID:INVALID@127.0.0.1/INVALID'
                     second_connection:
                          url: '%env(resolve:DATABASE_URL)%'
      

      2. In config/packages/ezplatform.yaml define a new repository:

           repositories:
                default:
                     storage: null
                     search:
                          engine: '%search_engine%'
                          connection: default
                new_repository:
                     storage:
                          engine: legacy
                          connection: second_connection
                          config: {  }
                     search:
                          connection: second_connection
      (...)
      

      3. And (in the same file) configure SiteAccess site and SiteAccess group admin_group to use it:

                site:
      (...)
                     repository: new_repository
                admin_group:
      (...)
                     repository: new_repository
      

      4. Run {{php bin/console c:c}
      5. Run php bin/console ibexa:install -vvv

      Expected result:
      Command uses default SiteAccess (site) which is configured to use the valid database connection - installer executes without trying to connect to the default (broken) database

      Actual result:

      In CommandExecutor.php line 74:
      
        [RuntimeException]
        An error occurred when executing the "'doctrine:schema:update --dump-sql --force'" command.
      
      
      Exception trace:
        at /Users/mareknocon/Desktop/Sites/v3/vendor/ibexa/installer/src/lib/Executor/CommandExecutor.php:74
       Ibexa\Platform\Installer\Executor\CommandExecutor->executeCommand() at /Users/mareknocon/Desktop/Sites/v3/vendor/ibexa/installer/src/lib/Provisioner/CommerceProvisioner.php:81
       Ibexa\Platform\Installer\Provisioner\CommerceProvisioner->provision() at /Users/mareknocon/Desktop/Sites/v3/vendor/ibexa/installer/src/lib/Installer/ExperienceInstaller.php:54
       Ibexa\Platform\Installer\Installer\ExperienceInstaller->importData() at /Users/mareknocon/Desktop/Sites/v3/var/cache/dev/ContainerHG4xDnR/ExperienceInstaller_1c03279.php:32
       ContainerHG4xDnR\ExperienceInstaller_1c03279->importData() at /Users/mareknocon/Desktop/Sites/v3/vendor/ezsystems/ezplatform-kernel/eZ/Bundle/PlatformInstallerBundle/src/Command/InstallPlatformCommand.php:101
       EzSystems\PlatformInstallerBundle\Command\InstallPlatformCommand->execute() at /Users/mareknocon/Desktop/Sites/v3/vendor/symfony/console/Command/Command.php:256
       Symfony\Component\Console\Command\Command->run() at /Users/mareknocon/Desktop/Sites/v3/vendor/symfony/console/Application.php:989
       Symfony\Component\Console\Application->doRunCommand() at /Users/mareknocon/Desktop/Sites/v3/vendor/symfony/framework-bundle/Console/Application.php:96
       Symfony\Bundle\FrameworkBundle\Console\Application->doRunCommand() at /Users/mareknocon/Desktop/Sites/v3/vendor/symfony/console/Application.php:290
       Symfony\Component\Console\Application->doRun() at /Users/mareknocon/Desktop/Sites/v3/vendor/symfony/framework-bundle/Console/Application.php:82
       Symfony\Bundle\FrameworkBundle\Console\Application->doRun() at /Users/mareknocon/Desktop/Sites/v3/vendor/symfony/console/Application.php:166
       Symfony\Component\Console\Application->run() at /Users/mareknocon/Desktop/Sites/v3/bin/console:43
      
      ibexa:install [--skip-indexing] [--siteaccess [SITEACCESS]] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [-e|--env ENV] [--no-debug] [--] [<type>]
      

      This issue applies to our DXP (OSS looks not affected). Also applies to php bin/console ibexa:upgrade Command - same error happens.

      Attachments

        Activity

          People

            Unassigned Unassigned
            marek.nocon@ibexa.co Marek NocoĊ„
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: