Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/bundle/Core/DependencyInjection/IbexaCoreExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@
{
$loader = new Loader\YamlFileLoader(
$container,
new FileLocator(__DIR__ . '/../Resources/config')

Check failure on line 115 in src/bundle/Core/DependencyInjection/IbexaCoreExtension.php

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Define a constant instead of duplicating this literal "/../Resources/config" 3 times.

See more on https://sonarcloud.io/project/issues?id=ibexa_core&issues=AaEg6sQexqoJwVxb4tiW&open=AaEg6sQexqoJwVxb4tiW&pullRequest=880
);

$configuration = $this->getConfiguration($configs, $container);
Expand All @@ -127,7 +127,11 @@
// Base services and services overrides
$loader->load('services.yml');
// Doctrine Migrations for core's own schema, alongside the legacy SchemaBuilderEvent path
$loader->load('doctrine_migrations.yml');
$phpLoader = new Loader\PhpFileLoader(
$container,
new FileLocator(__DIR__ . '/../Resources/config')
);
$phpLoader->load('doctrine_migrations.php');
// Security services
$loader->load('security.yml');
// HTTP Kernel
Expand Down
76 changes: 76 additions & 0 deletions src/bundle/Core/Resources/config/doctrine_migrations.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
<?php

/**
* @copyright Copyright (C) Ibexa AS. All rights reserved.
* @license For full copyright and license information view LICENSE file distributed with this source code.
*/
declare(strict_types=1);

use Ibexa\Bundle\RepositoryInstaller\Migration\AddContentVersionUniqueIndexMigration;
use Ibexa\Bundle\RepositoryInstaller\Migration\AddUrlAliasMlLinkIndexMigration;
use Ibexa\Bundle\RepositoryInstaller\Migration\ConvertMariaDbJsonColumnsMigration;
use Ibexa\Bundle\RepositoryInstaller\Migration\ConvertMariaDbJsonColumnsTo6_0Migration;
use Ibexa\Bundle\RepositoryInstaller\Migration\ConvertPostgreSqlSerialColumnsToIdentityMigration;
use Ibexa\Bundle\RepositoryInstaller\Migration\FixLegacyIdentifiersMigration;
use Ibexa\Bundle\RepositoryInstaller\Migration\ImportDataMigration;
use Ibexa\Bundle\RepositoryInstaller\Migration\InstallSchemaMigration;
use Ibexa\Bundle\RepositoryInstaller\Migration\RecreateMariaDbBookmarkForeignKeysMigration;
use Ibexa\Bundle\RepositoryInstaller\Migration\RenamePostgreSqlPrimaryKeysMigration;
use Ibexa\Bundle\RepositoryInstaller\Migration\RenameSchemaTo5_0Migration;
use Ibexa\Contracts\DoctrineMigrations\Migrations\IbexaMigrationTag;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use function Symfony\Component\DependencyInjection\Loader\Configurator\service;

return static function (ContainerConfigurator $configurator): void {
$services = $configurator->services();

$services
->defaults()
->autowire()
->autoconfigure(false)
->private();

$services->set(InstallSchemaMigration::class)
->arg('$connection', service('ibexa.persistence.connection'))

Check failure on line 34 in src/bundle/Core/Resources/config/doctrine_migrations.php

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Define a constant instead of duplicating this literal "$connection" 11 times.

See more on https://sonarcloud.io/project/issues?id=ibexa_core&issues=AaEg6sanxqoJwVxb4tiX&open=AaEg6sanxqoJwVxb4tiX&pullRequest=880
->tag(IbexaMigrationTag::TAG);

$services->set(AddUrlAliasMlLinkIndexMigration::class)
->arg('$connection', service('ibexa.persistence.connection'))
->tag(IbexaMigrationTag::TAG);

$services->set(RenameSchemaTo5_0Migration::class)
->arg('$connection', service('ibexa.persistence.connection'))
->tag(IbexaMigrationTag::TAG);

$services->set(ConvertMariaDbJsonColumnsMigration::class)
->arg('$connection', service('ibexa.persistence.connection'))
->tag(IbexaMigrationTag::TAG);

$services->set(ImportDataMigration::class)
->arg('$connection', service('ibexa.persistence.connection'))
->tag(IbexaMigrationTag::TAG);

$services->set(FixLegacyIdentifiersMigration::class)
->arg('$connection', service('ibexa.persistence.connection'))
->tag(IbexaMigrationTag::TAG);

$services->set(RenamePostgreSqlPrimaryKeysMigration::class)
->arg('$connection', service('ibexa.persistence.connection'))
->tag(IbexaMigrationTag::TAG);

$services->set(RecreateMariaDbBookmarkForeignKeysMigration::class)
->arg('$connection', service('ibexa.persistence.connection'))
->tag(IbexaMigrationTag::TAG);

$services->set(AddContentVersionUniqueIndexMigration::class)
->arg('$connection', service('ibexa.persistence.connection'))
->tag(IbexaMigrationTag::TAG);

$services->set(ConvertMariaDbJsonColumnsTo6_0Migration::class)
->arg('$connection', service('ibexa.persistence.connection'))
->tag(IbexaMigrationTag::TAG);

$services->set(ConvertPostgreSqlSerialColumnsToIdentityMigration::class)
->arg('$connection', service('ibexa.persistence.connection'))
->tag(IbexaMigrationTag::TAG);
};
88 changes: 0 additions & 88 deletions src/bundle/Core/Resources/config/doctrine_migrations.yml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ public function load(array $configs, ContainerBuilder $container): void
$loader->load('services.yml');

if ($this->shouldRegisterBootstrapperHook($container)) {
$loader->load('bootstrapper.yaml');
$phpLoader = new Loader\PhpFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
$phpLoader->load('bootstrapper.php');
}
}

Expand Down
28 changes: 28 additions & 0 deletions src/bundle/RepositoryInstaller/Resources/config/bootstrapper.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

/**
* @copyright Copyright (C) Ibexa AS. All rights reserved.
* @license For full copyright and license information view LICENSE file distributed with this source code.
*/
declare(strict_types=1);

use Ibexa\Bundle\RepositoryInstaller\Bootstrapper\DoctrineMigrationsSchemaHook;
use Ibexa\Bundle\RepositoryInstaller\Migration\TaggedMigrationsRunner;
use Ibexa\Contracts\Test\Core\Bootstrapper\HookInterface;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use function Symfony\Component\DependencyInjection\Loader\Configurator\service;

// Integration-test bootstrap hooks (see ibexa/test-core's Bootstrapper). Loaded only in the "test"
// environment, and only when ibexa/test-core is actually installed - see
// IbexaRepositoryInstallerExtension::shouldRegisterBootstrapperHook().
return static function (ContainerConfigurator $configurator): void {
$services = $configurator->services();

$services->set(DoctrineMigrationsSchemaHook::class)
->private()
// Mandatory: both this definition and TaggedMigrationsRunner's own are removed by
// RemoveTaggedMigrationsRunnerPass when "ibexa/doctrine-migrations" isn't
// installed/enabled, so compilation never attempts to resolve this reference then.
->arg('$taggedMigrationsRunner', service(TaggedMigrationsRunner::class))
->tag(HookInterface::TAG, ['priority' => DoctrineMigrationsSchemaHook::PRIORITY]);
};
14 changes: 0 additions & 14 deletions src/bundle/RepositoryInstaller/Resources/config/bootstrapper.yaml

This file was deleted.

Loading