[PR #847] [CLOSED] Removed final from PersistentCollection #8790

Open
opened 2026-01-22 16:01:43 +01:00 by admin · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/doctrine/orm/pull/847
Author: @maryo
Created: 11/15/2013
Status: Closed

Base: masterHead: master


📝 Commits (4)

📊 Changes

108 files changed (+1551 additions, -2454 deletions)

View changed files

📝 .travis.yml (+1 -1)
📝 README.markdown (+0 -1)
📝 build.properties (+9 -1)
📝 build.xml (+100 -87)
📝 composer.json (+2 -5)
docs/en/cookbook/custom-mapping-types.rst (+0 -97)
📝 docs/en/cookbook/dql-custom-walkers.rst (+1 -1)
📝 docs/en/cookbook/resolve-target-entity-listener.rst (+3 -8)
📝 docs/en/index.rst (+20 -22)
📝 docs/en/reference/advanced-configuration.rst (+26 -62)
📝 docs/en/reference/annotations-reference.rst (+1 -27)
📝 docs/en/reference/association-mapping.rst (+252 -201)
📝 docs/en/reference/basic-mapping.rst (+398 -210)
📝 docs/en/reference/caching.rst (+1 -1)
📝 docs/en/reference/configuration.rst (+6 -7)
📝 docs/en/reference/dql-doctrine-query-language.rst (+2 -11)
📝 docs/en/reference/events.rst (+52 -70)
📝 docs/en/reference/faq.rst (+1 -1)
📝 docs/en/reference/inheritance-mapping.rst (+0 -1)
📝 docs/en/reference/native-sql.rst (+1 -1)

...and 80 more files

📄 Description

I would like to be able to extend PersistentCollection. But it is final.

There is "@todo Design for inheritance to allow custom implementations?" in PersistentCollection.php.

Ofc it needs more modifications because the instantiation of PersistentCollections is hardcoded in UnitOfWork and ObjectHydrator classes. Creating something like PersistentCollectionFactory or persistentCollectionClass could solve it but there are already lots of dependencies in those classes. I can live with the hardoded state. I can somehow "hack" it so it will always replace PersistentCollection instances with my own which extends PersistentCollection when they are set. It's ugly but it could work..

So... At least removing the final statement helps me and could be a good start. Switching from private to protected for $em and $coll helps me also so i can read them in the descendant class but it can be "hacked" too even if i don't like hacks). Or getEntityManager() and getOriginalCollection() could be added.

If you can't accept this PR, let me know about the idea how "@todo Design for inheritance to allow custom implementations?" could be implemented and i will do it. If using a factory, class name or whatever.


🔄 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/847 **Author:** [@maryo](https://github.com/maryo) **Created:** 11/15/2013 **Status:** ❌ Closed **Base:** `master` ← **Head:** `master` --- ### 📝 Commits (4) - [`601e5ed`](https://github.com/doctrine/orm/commit/601e5ede7bd85f733b59346ed5f37ecc457ec8fd) Update PersistentCollection.php - [`6129dc5`](https://github.com/doctrine/orm/commit/6129dc5535e24acc1bcddd9c5282be1ad25d238e) Revert to 13c1efb240dd0af25ad0abe230df98ec895892c7 - [`1a9146a`](https://github.com/doctrine/orm/commit/1a9146ad50ff66a241995a0597a776cf73c00a15) Removed final from Query - [`fac288d`](https://github.com/doctrine/orm/commit/fac288df496e648bac61388f25c37e4290a40f8e) Replaces hardcoded name of the class with static in EntityManager::create ### 📊 Changes **108 files changed** (+1551 additions, -2454 deletions) <details> <summary>View changed files</summary> 📝 `.travis.yml` (+1 -1) 📝 `README.markdown` (+0 -1) 📝 `build.properties` (+9 -1) 📝 `build.xml` (+100 -87) 📝 `composer.json` (+2 -5) ➖ `docs/en/cookbook/custom-mapping-types.rst` (+0 -97) 📝 `docs/en/cookbook/dql-custom-walkers.rst` (+1 -1) 📝 `docs/en/cookbook/resolve-target-entity-listener.rst` (+3 -8) 📝 `docs/en/index.rst` (+20 -22) 📝 `docs/en/reference/advanced-configuration.rst` (+26 -62) 📝 `docs/en/reference/annotations-reference.rst` (+1 -27) 📝 `docs/en/reference/association-mapping.rst` (+252 -201) 📝 `docs/en/reference/basic-mapping.rst` (+398 -210) 📝 `docs/en/reference/caching.rst` (+1 -1) 📝 `docs/en/reference/configuration.rst` (+6 -7) 📝 `docs/en/reference/dql-doctrine-query-language.rst` (+2 -11) 📝 `docs/en/reference/events.rst` (+52 -70) 📝 `docs/en/reference/faq.rst` (+1 -1) 📝 `docs/en/reference/inheritance-mapping.rst` (+0 -1) 📝 `docs/en/reference/native-sql.rst` (+1 -1) _...and 80 more files_ </details> ### 📄 Description I would like to be able to extend PersistentCollection. But it is final. There is "@todo Design for inheritance to allow custom implementations?" in PersistentCollection.php. Ofc it needs more modifications because the instantiation of PersistentCollections is hardcoded in UnitOfWork and ObjectHydrator classes. Creating something like PersistentCollectionFactory or persistentCollectionClass could solve it but there are already lots of dependencies in those classes. I can live with the hardoded state. I can somehow "hack" it so it will always replace PersistentCollection instances with my own which extends PersistentCollection when they are set. It's ugly but it could work.. So... At least removing the final statement helps me and could be a good start. Switching from private to protected for $em and $coll helps me also so i can read them in the descendant class but it can be "hacked" too even if i don't like hacks). Or getEntityManager() and getOriginalCollection() could be added. If you can't accept this PR, let me know about the idea how "@todo Design for inheritance to allow custom implementations?" could be implemented and i will do it. If using a factory, class name or whatever. --- <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 16:01: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#8790