Skip to content
Open
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
11 changes: 11 additions & 0 deletions dependencies.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"recipesEndpoint": "",
"packages": [
{
"requirement": "dev-feature/schema-applier-4.6 as 4.6.x-dev",
"repositoryUrl": "https://github.com/ibexa/doctrine-schema.git",
"package": "ibexa/doctrine-schema",
"shouldBeAddedAsVCS": false
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

use Ibexa\Bundle\RepositoryInstaller\Event\Subscriber\BuildSchemaSubscriber;
use Ibexa\Contracts\Core\Test\Persistence\Fixture\FixtureImporter;
use Ibexa\Contracts\DoctrineSchema\Builder\SchemaApplierInterface;
use Ibexa\Contracts\DoctrineSchema\Builder\SchemaBuilderInterface;
use Ibexa\Contracts\Test\Core\Bootstrapper\DatabaseSchemaHook;
use Ibexa\Contracts\Test\Core\Bootstrapper\FixtureHook;
Expand All @@ -30,6 +31,7 @@ final class RemoveUnsatisfiableHooksPass implements CompilerPassInterface
private const HOOK_REQUIREMENTS = [
DatabaseSchemaHook::class => [
SchemaBuilderInterface::class,
SchemaApplierInterface::class,
// core's own schema contribution; without it the event yields every other package's
// tables but none of core's
BuildSchemaSubscriber::class,
Expand Down
16 changes: 6 additions & 10 deletions src/contracts/Bootstrapper/DatabaseSchemaHook.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

namespace Ibexa\Contracts\Test\Core\Bootstrapper;

use Doctrine\DBAL\Connection;
use Ibexa\Contracts\DoctrineSchema\Builder\SchemaApplierInterface;
use Ibexa\Contracts\DoctrineSchema\Builder\SchemaBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;

Expand All @@ -33,12 +33,12 @@ final class DatabaseSchemaHook implements HookInterface

private SchemaBuilderInterface $schemaBuilder;

private Connection $connection;
private SchemaApplierInterface $schemaApplier;

public function __construct(SchemaBuilderInterface $schemaBuilder, Connection $connection)
public function __construct(SchemaBuilderInterface $schemaBuilder, SchemaApplierInterface $schemaApplier)
{
$this->schemaBuilder = $schemaBuilder;
$this->connection = $connection;
$this->schemaApplier = $schemaApplier;
}

public function configureOptions(OptionsResolver $resolver): void
Expand All @@ -54,11 +54,7 @@ public function __invoke(array $options): void
return;
}

$schema = $this->schemaBuilder->buildSchema();
$platform = $this->connection->getDatabasePlatform();

foreach ($schema->toSql($platform) as $sql) {
$this->connection->executeStatement($sql);
}
// the test database is always freshly created, so there is nothing to drop first
$this->schemaApplier->applySchema($this->schemaBuilder->buildSchema());
}
}
7 changes: 7 additions & 0 deletions src/contracts/Bootstrapper/DefaultSchemaFilesProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@
* class exists purely so another provider can constructor-inject it directly to compose with the
* built-in default without going through a Kernel method.
*/
/**
* @deprecated since Ibexa 4.6.x, no longer used by anything in this package. It exists only to back
* {@see \Ibexa\Contracts\Test\Core\IbexaTestKernel::getSchemaFiles()}, itself deprecated:
* the test schema is now built from
* {@see \Ibexa\Contracts\DoctrineSchema\Event\SchemaBuilderEvent} rather than from a list
* of raw schema files. Will be removed in 6.0.
*/
final class DefaultSchemaFilesProvider
{
private KernelInterface $kernel;
Expand Down
7 changes: 7 additions & 0 deletions src/contracts/IbexaTestKernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,13 @@ public static function getAliasServiceId(string $id): string

/**
* @return iterable<string>
*
* @deprecated since Ibexa 4.6.x. The test schema is built from
* {@see \Ibexa\Contracts\DoctrineSchema\Event\SchemaBuilderEvent} β€” whichever bundles
* a kernel registers is what the schema contains β€” so a kernel no longer declares
* schema files, and overriding this serves no purpose. Retained because
* {@see \Ibexa\Contracts\Core\Test\IbexaTestKernelInterface} still mandates it.
* Will be removed in 6.0.
*/
public function getSchemaFiles(): iterable
{
Expand Down