[PR #418] [CLOSED] Add ODM embedded-like functionality #8165

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

📋 Pull Request Information

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

Base: masterHead: MappedAssociation2


📝 Commits (10+)

  • ab24670 New MappedAssociation annotation.
  • 24e4676 Include MappedAssociation annotation.
  • 4618712 Annotation driver support for MappedAssocation annotation.
  • b01a183 Added array to hold mapped associations.
  • cb85c03 Include mapped associations in sleep and reflection wakeup.
  • 6427bf6 Added method addMappedAssociation to validate and add mapped association to class.
  • 090f206 Added mapped association exceptions.
  • 96d3f39 Added utility functions to check if class has mapped associations and getter.
  • d6a600d Whitespace.
  • 7fedd86 Added method addMappedAssociationDiscriminatorColumnDefinitions to add mapped association descriminator columns to the table.

📊 Changes

21 files changed (+954 additions, -24 deletions)

View changed files

📝 lib/Doctrine/ORM/Internal/Hydration/SimpleObjectHydrator.php (+3 -1)
📝 lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php (+88 -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 (+73 -14)
📝 lib/Doctrine/ORM/Tools/SchemaTool.php (+34 -3)
📝 lib/Doctrine/ORM/UnitOfWork.php (+12 -3)
tests/Doctrine/Tests/Models/MappedAssociation/DiscretePrimary/AbstractObject.php (+71 -0)
tests/Doctrine/Tests/Models/MappedAssociation/DiscretePrimary/Book.php (+11 -0)
tests/Doctrine/Tests/Models/MappedAssociation/DiscretePrimary/Shelf.php (+93 -0)
tests/Doctrine/Tests/Models/MappedAssociation/DiscretePrimary/Video.php (+11 -0)
tests/Doctrine/Tests/Models/MappedAssociation/PrimaryIsForeign/AbstractContent.php (+55 -0)
tests/Doctrine/Tests/Models/MappedAssociation/PrimaryIsForeign/FileFolder.php (+93 -0)
tests/Doctrine/Tests/Models/MappedAssociation/PrimaryIsForeign/Paper.php (+11 -0)
tests/Doctrine/Tests/Models/MappedAssociation/PrimaryIsForeign/Photo.php (+11 -0)
tests/Doctrine/Tests/ORM/Functional/MappedAssociationTest.php (+274 -0)

...and 1 more files

📄 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 ID and association to be extended by additional entities without requiring any code changes (as is required 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, and all the existing tests continue to pass (the ones that weren't skipped anyways).


🔄 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/418 **Author:** [@djlambert](https://github.com/djlambert) **Created:** 8/6/2012 **Status:** ❌ Closed **Base:** `master` ← **Head:** `MappedAssociation2` --- ### 📝 Commits (10+) - [`ab24670`](https://github.com/doctrine/orm/commit/ab24670d5507f76da9e9bfc7425880e396201c1d) New MappedAssociation annotation. - [`24e4676`](https://github.com/doctrine/orm/commit/24e4676919afc1ac6639f7496f5332eb8fd64754) Include MappedAssociation annotation. - [`4618712`](https://github.com/doctrine/orm/commit/46187121150cdaeedab2b27da8f5227bed65baf0) Annotation driver support for MappedAssocation annotation. - [`b01a183`](https://github.com/doctrine/orm/commit/b01a183b737261a1133478a836eccc7e94eec392) Added array to hold mapped associations. - [`cb85c03`](https://github.com/doctrine/orm/commit/cb85c03dd307ca7d9b627bf2dd9f0144a9a43031) Include mapped associations in sleep and reflection wakeup. - [`6427bf6`](https://github.com/doctrine/orm/commit/6427bf6bcd4f39419383a8bcb26cf81e1556fd76) Added method addMappedAssociation to validate and add mapped association to class. - [`090f206`](https://github.com/doctrine/orm/commit/090f2065c5a6055c2ae933e1610b57e47953595c) Added mapped association exceptions. - [`96d3f39`](https://github.com/doctrine/orm/commit/96d3f398a976fb2583a214fc7e942542f693f3d6) Added utility functions to check if class has mapped associations and getter. - [`d6a600d`](https://github.com/doctrine/orm/commit/d6a600dc8fa60dbc4dd5be79ac20203ae4ea6ed6) Whitespace. - [`7fedd86`](https://github.com/doctrine/orm/commit/7fedd868431f9f3f7b1479a16fb2b876c8574e90) Added method addMappedAssociationDiscriminatorColumnDefinitions to add mapped association descriminator columns to the table. ### 📊 Changes **21 files changed** (+954 additions, -24 deletions) <details> <summary>View changed files</summary> 📝 `lib/Doctrine/ORM/Internal/Hydration/SimpleObjectHydrator.php` (+3 -1) 📝 `lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php` (+88 -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` (+73 -14) 📝 `lib/Doctrine/ORM/Tools/SchemaTool.php` (+34 -3) 📝 `lib/Doctrine/ORM/UnitOfWork.php` (+12 -3) ➕ `tests/Doctrine/Tests/Models/MappedAssociation/DiscretePrimary/AbstractObject.php` (+71 -0) ➕ `tests/Doctrine/Tests/Models/MappedAssociation/DiscretePrimary/Book.php` (+11 -0) ➕ `tests/Doctrine/Tests/Models/MappedAssociation/DiscretePrimary/Shelf.php` (+93 -0) ➕ `tests/Doctrine/Tests/Models/MappedAssociation/DiscretePrimary/Video.php` (+11 -0) ➕ `tests/Doctrine/Tests/Models/MappedAssociation/PrimaryIsForeign/AbstractContent.php` (+55 -0) ➕ `tests/Doctrine/Tests/Models/MappedAssociation/PrimaryIsForeign/FileFolder.php` (+93 -0) ➕ `tests/Doctrine/Tests/Models/MappedAssociation/PrimaryIsForeign/Paper.php` (+11 -0) ➕ `tests/Doctrine/Tests/Models/MappedAssociation/PrimaryIsForeign/Photo.php` (+11 -0) ➕ `tests/Doctrine/Tests/ORM/Functional/MappedAssociationTest.php` (+274 -0) _...and 1 more files_ </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 ID and association to be extended by additional entities without requiring any code changes (as is required 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, and all the existing tests continue to pass (the ones that weren't skipped anyways). --- <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:43 +01:00
admin closed this issue 2026-01-22 15:58:43 +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#8165