[PR #419] [CLOSED] Add ODM embedded-like functionality #8163

Open
opened 2026-01-22 15:58:42 +01:00 by admin · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/doctrine/orm/pull/419
Author: @djlambert
Created: 8/7/2012
Status: Closed

Base: masterHead: MappedAssociation3


📝 Commits (10+)

  • 9d487c7 New MappedAssociation annotation.
  • 0e55b8a Annotation driver support for MappedAssocation annotation.
  • 8be7fd9 Added array to hold mapped associations.
  • 34925e9 Include mapped associations in sleep and reflection wakeup.
  • b5032bd Added method addMappedAssociation to validate and add mapped association to class.
  • ca160d9 Added mapped association exceptions.
  • b165068 Added utility functions to check if class has mapped associations and getter.
  • 457c439 Added method addMappedAssociationDiscriminatorColumnDefinitions to add mapped association descriminator columns to the table.
  • f15895c Add mapped association discriminator columns to the schema.
  • be0c83b Include mapped association in change detection.

📊 Changes

17 files changed (+610 additions, -22 deletions)

View changed files

📝 lib/Doctrine/ORM/Internal/Hydration/SimpleObjectHydrator.php (+3 -1)
📝 lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php (+74 -0)
📝 lib/Doctrine/ORM/Mapping/DefaultQuoteStrategy.php (+12 -2)
📝 lib/Doctrine/ORM/Mapping/Driver/AnnotationDriver.php (+12 -0)
📝 lib/Doctrine/ORM/Mapping/Driver/DoctrineAnnotations.php (+1 -0)
lib/Doctrine/ORM/Mapping/MappedAssociation.php (+36 -0)
📝 lib/Doctrine/ORM/Mapping/MappingException.php (+22 -0)
📝 lib/Doctrine/ORM/Mapping/QuoteStrategy.php (+12 -1)
📝 lib/Doctrine/ORM/Persisters/BasicEntityPersister.php (+69 -14)
📝 lib/Doctrine/ORM/Tools/SchemaTool.php (+24 -1)
📝 lib/Doctrine/ORM/UnitOfWork.php (+12 -3)
tests/Doctrine/Tests/Models/MappedAssociation/AbstractContent.php (+56 -0)
tests/Doctrine/Tests/Models/MappedAssociation/FileFolder.php (+93 -0)
tests/Doctrine/Tests/Models/MappedAssociation/Paper.php (+11 -0)
tests/Doctrine/Tests/Models/MappedAssociation/Photo.php (+11 -0)
tests/Doctrine/Tests/ORM/Functional/MappedAssociationTest.php (+150 -0)
📝 tests/Doctrine/Tests/OrmFunctionalTestCase.php (+12 -0)

📄 Description

This PR adds ODM embedded-like functionality to the ORM.

Including the new @MappedAssociation annotation on a field having a one-to-one association adds a discriminator column to the table for storing the class name of a "mapped" entity.

This allows a class or mapped superclass with a one-to-one identifying association to be extended by additional entities without requiring any code changes (as is required with the discriminator map when using inheritance).

I apologize if this is the incorrect way to submit a feature request. Currently just the annotation driver has been updated, I wanted to get feedback before continuing with the remaining drivers. Models and tests are included.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/doctrine/orm/pull/419 **Author:** [@djlambert](https://github.com/djlambert) **Created:** 8/7/2012 **Status:** ❌ Closed **Base:** `master` ← **Head:** `MappedAssociation3` --- ### 📝 Commits (10+) - [`9d487c7`](https://github.com/doctrine/orm/commit/9d487c794de693c648897a465c1824925843058f) New MappedAssociation annotation. - [`0e55b8a`](https://github.com/doctrine/orm/commit/0e55b8ace9432183a90e61766e6774cd84cfd7f1) Annotation driver support for MappedAssocation annotation. - [`8be7fd9`](https://github.com/doctrine/orm/commit/8be7fd93d3aaadb987a38342e6e2337255bd5ba7) Added array to hold mapped associations. - [`34925e9`](https://github.com/doctrine/orm/commit/34925e961bb015f5f679f1ada80e7981dbda7a79) Include mapped associations in sleep and reflection wakeup. - [`b5032bd`](https://github.com/doctrine/orm/commit/b5032bdd3ba27e7997858f3ffc57720815673010) Added method addMappedAssociation to validate and add mapped association to class. - [`ca160d9`](https://github.com/doctrine/orm/commit/ca160d96bf41b8e6a8d88dc57f8dcbf7bcca6d77) Added mapped association exceptions. - [`b165068`](https://github.com/doctrine/orm/commit/b1650682e2f21311e181896c2bfe3bf343581978) Added utility functions to check if class has mapped associations and getter. - [`457c439`](https://github.com/doctrine/orm/commit/457c4391413856461f7aeaec7352c3753f2b3101) Added method addMappedAssociationDiscriminatorColumnDefinitions to add mapped association descriminator columns to the table. - [`f15895c`](https://github.com/doctrine/orm/commit/f15895c9ab6444e3be77694ccd110e19c934d54e) Add mapped association discriminator columns to the schema. - [`be0c83b`](https://github.com/doctrine/orm/commit/be0c83becc9f6eedcd80bb66ffae7b8e86566fee) Include mapped association in change detection. ### 📊 Changes **17 files changed** (+610 additions, -22 deletions) <details> <summary>View changed files</summary> 📝 `lib/Doctrine/ORM/Internal/Hydration/SimpleObjectHydrator.php` (+3 -1) 📝 `lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php` (+74 -0) 📝 `lib/Doctrine/ORM/Mapping/DefaultQuoteStrategy.php` (+12 -2) 📝 `lib/Doctrine/ORM/Mapping/Driver/AnnotationDriver.php` (+12 -0) 📝 `lib/Doctrine/ORM/Mapping/Driver/DoctrineAnnotations.php` (+1 -0) ➕ `lib/Doctrine/ORM/Mapping/MappedAssociation.php` (+36 -0) 📝 `lib/Doctrine/ORM/Mapping/MappingException.php` (+22 -0) 📝 `lib/Doctrine/ORM/Mapping/QuoteStrategy.php` (+12 -1) 📝 `lib/Doctrine/ORM/Persisters/BasicEntityPersister.php` (+69 -14) 📝 `lib/Doctrine/ORM/Tools/SchemaTool.php` (+24 -1) 📝 `lib/Doctrine/ORM/UnitOfWork.php` (+12 -3) ➕ `tests/Doctrine/Tests/Models/MappedAssociation/AbstractContent.php` (+56 -0) ➕ `tests/Doctrine/Tests/Models/MappedAssociation/FileFolder.php` (+93 -0) ➕ `tests/Doctrine/Tests/Models/MappedAssociation/Paper.php` (+11 -0) ➕ `tests/Doctrine/Tests/Models/MappedAssociation/Photo.php` (+11 -0) ➕ `tests/Doctrine/Tests/ORM/Functional/MappedAssociationTest.php` (+150 -0) 📝 `tests/Doctrine/Tests/OrmFunctionalTestCase.php` (+12 -0) </details> ### 📄 Description This PR adds ODM embedded-like functionality to the ORM. Including the new _@MappedAssociation_ annotation on a field having a one-to-one association adds a discriminator column to the table for storing the class name of a "mapped" entity. This allows a class or mapped superclass with a one-to-one identifying association to be extended by additional entities without requiring any code changes (as is required with the discriminator map when using inheritance). I apologize if this is the incorrect way to submit a feature request. Currently just the annotation driver has been updated, I wanted to get feedback before continuing with the remaining drivers. Models and tests are included. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
admin added the pull-request label 2026-01-22 15:58:42 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#8163