Skip to content

feat: 1.24.0 DDD host mapping switch (register_mapping, mapping_type, entity_manager) - #79

Merged
HecFranco merged 2 commits into
mainfrom
feat/1.24.0-ddd-host
Nov 21, 2026
Merged

HecFranco merged 2 commits into
mainfrom
feat/1.24.0-ddd-host

Conversation

@HecFranco

Copy link
Copy Markdown
Contributor

HttpLogBundle 1.24.0: DDD host mapping switch (wave D6, B3)

Additive minor; defaults unchanged (standard Symfony host keeps the 1.23 attribute mapping on the default manager).

Added

  • nowo_http_log.doctrine.register_mapping (default true): false leaves the HttpLogEntry mapping to the host; the bundle then prepends a disabled NowoHttpLogBundle mapping so Doctrine auto_mapping does not map the entity on the auto-mapped manager too (unless the host already uses that name).
  • nowo_http_log.doctrine.mapping_type (attribute | xml): xml registers the shipped src/Resources/config/doctrine/HttpLogEntry.orm.xml (same table, columns, options, indexes, repository).
  • nowo_http_log.doctrine.entity_manager (default null): maps the entity on that manager instead of the default one (must be declared; prepend() fails otherwise instead of creating a manager). New HttpLogEntityManagerPass fails the build unless that manager is the only one mapping Nowo\HttpLogBundle\Entity (services resolve it with getManagerForClass()).
  • All three are compile-time literals (%env()% rejected).
  • Internal EntityManagerMappings helper shared with HttpLogCommitTrackingPass (same behaviour).

Guarantees

  • Redaction untouched; no new storage path (entries still written by DBAL on the mapping manager's connection, never a host flush).
  • No host entity reaches a bundle manager; the dedicated manager maps only the bundle entity (kernel test asserts it).
  • Worker mode / kernel reset false: no new state; REQ-RUNTIME-003 unchanged (DB suites pass).

Tests

  • XmlMappingParityTest: XML vs attributes (metadata, column declarations on SQLite/MySQL/PostgreSQL, indexes) with the path-prefix and table-prefix listeners.
  • DedicatedEntityManagerKernelTest: XML host leg on a dedicated manager + connection, mapped by the bundle or by the host under its own name, auto_mapping on the host manager, pending host change never flushed, double mapping fails the build.
  • DoctrineMappingExtensionTest, HttpLogEntityManagerPassTest.

Gates (local Docker, PHP 8.2 / Symfony 7.4)

PHPUnit 1035 tests incl. DB suites (MySQL 8.4, MariaDB 11.4, PostgreSQL 16) PASS; coverage 100 % (5699/5699); PHPStan level 8 PASS; php-cs-fixer PASS; rector dry-run PASS; Igor PASS.

Notes

  • Doctrine's XML driver maps the id after the fields, so a fresh CREATE TABLE from XML lists id last; the schema comparator ignores column order (no diff on existing tables). Boolean defaults are 0 in the XML (same DDL as the attributes' false).
  • Docs: CHANGELOG [Unreleased], UPGRADING, CONFIGURATION (Mapping and entity manager), USAGE (DDD host), INSTALLATION.

@github-actions

Copy link
Copy Markdown

@coderabbitai review

@HecFranco
HecFranco marked this pull request as ready for review November 21, 2026 12:44
@HecFranco
HecFranco merged commit 749b2a1 into main Nov 21, 2026
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant