Skip to content

Clean up the legacy mapping machinery (alias, auto_mapping, bundle detection) for the next major #2278

Description

@Nayte91

Follow-up of #2124 (entity auto-discovery): assuming #2277 passes, it allows cutting down some existing logic:

  • alias feeds a write-only API — nothing reads entity namespaces in ORM 3 anymore (Bridge's $aliasMap already deprecated in 8.1),
  • The entire bundle-detection tree (auto_mapping, is_bundle, relative dirs, detectMetadataDriver, mapping: false, ... ~250 lines) becomes redundant: DoctrineOrmMappingsPass covers bundles, auto_discover_entities covers apps. Precedent: controller_resolver.auto_mapping, removed 3.0 → 4.0.
  • mappings key survives with its simplest form — {type, absolute dir, prefix}.

About auto_mapping specifically: this key auto-registers entities for registered bundles. It's old (2011), lost its main purpose in 2017 when the app stopped being a bundle, and is largely superseded by DoctrineOrmMappingsPass for bundles that self-register. It has the exact same parallel life as auto_discover_entities. Can be a good candidate to disappear in next major?

Suggested path — deprecate in 3.x, remove in 4.0:

  • Deprecate alias (independent — dead code already, can start now)
  • Deprecate the bundle-detection tree (auto_mapping, is_bundle, relative dirs, mapping: false) — once Add auto_discover_entities option to register entities discovered by the container scan #2277 is merged
  • symfony/recipes: drop auto_mapping: true from the doctrine-bundle recipe, aligned with the deprecating release
  • 4.0: remove the deprecated code paths, trim mappings down to {type, absolute dir, prefix}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions