Skip to content

IBX-11939: Added a shared SchemaBuilderEvent subscriber for plain ORM entities - #852

Merged
Steveb-p merged 4 commits into
4.6from
feature/orm-entities-schema-subscriber-4.6
Sep 29, 2026
Merged

Steveb-p merged 4 commits into
4.6from
feature/orm-entities-schema-subscriber-4.6

Conversation

@Steveb-p

@Steveb-p Steveb-p commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor
🎫 Issue IBX-11939

Related PRs:

Description:

Extracted from #785 so it can be reviewed and merged on its own. #785 keeps the same code for now, so it stays testable as it is; once this lands, its diff shrinks by this much on the next sync with 4.6.

OrmEntitiesSchemaSubscriber contributes the tables (and sequences) of a given list of plain Doctrine ORM entities to the SchemaBuilderEvent schema, generated from their mappings via SchemaTool. ibexa/taxonomy#431 and ibexa/connector-payum#39 each carried an identical copy of this logic; each now just registers its own instance, listing its own entities:

ibexa.<package>.schema_builder.orm_entities:
    class: Ibexa\Bundle\RepositoryInstaller\Event\Subscriber\OrmEntitiesSchemaSubscriber
    arguments:
        $entityManager: '@ibexa.doctrine.orm.entity_manager'
        $entityClasses:
            - Ibexa\<Package>\Persistence\Entity\SomeEntity
    tags: [kernel.event_subscriber]

Only the listed entities' own tables are copied over. SchemaTool::getSchemaFromMetadata() fires postGenerateSchema on the entity manager's shared event manager, so any other listener there (Messenger's Doctrine transport auto-setup, for one) adds its own table to the ORM schema too - those are skipped, as are tables the target schema already has.

Two small test fixes come along, because without them the new test wouldn't run in CI at all. The bundle_installer suite in phpunit.xml still pointed at tests/bundle/Installer, gone since IBX-538, so none of the RepositoryInstaller bundle tests ran. Running them again surfaced IbexaInstallerExtensionTest still asserting the pre-IBX-538 clean installer type. 5.0 already has both.

…positoryInstaller

The suite still pointed at tests/bundle/Installer, which hasn't existed since the IBX-538 rename,
so none of the RepositoryInstaller bundle tests ran. Same path the 5.0 branch already uses.
IBX-538 renamed CoreInstaller's installer type from "clean" to "ibexa-oss", but the moved test
kept asserting the old one. It went unnoticed because the suite never ran these tests.
… entities

OrmEntitiesSchemaSubscriber contributes the tables (and sequences) of a given list of Doctrine
ORM entities to the SchemaBuilderEvent schema, derived from their mappings via SchemaTool.

ibexa/taxonomy and ibexa/connector-payum each carried an identical copy of this logic, differing
only in the entity list. Each package now registers its own instance of this class instead,
listing just its own entities.
@sonarqubecloud

Copy link
Copy Markdown

@Steveb-p
Steveb-p merged commit ed65d97 into 4.6 Sep 29, 2026
48 checks passed
@Steveb-p
Steveb-p deleted the feature/orm-entities-schema-subscriber-4.6 branch September 29, 2026 09:11
Steveb-p added a commit that referenced this pull request Sep 29, 2026
…line-sql' into base/ibx-11939-4.6-merged-5.0

#785 was rebased onto 4.6 after #852 landed there. Its tree is identical to
the pre-rebase head f75405c this base already contains, so this merge only records the
rebased history and keeps the base's own tree (-s ours). A regular merge would have gone back
to the old merge base and re-applied the lines of #785 that earlier merges here resolved the
5.0 way.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants