DDC-391: Allow to specifiy custom Entity and Collection Persister classes #484

Open
opened 2026-01-22 12:40:00 +01:00 by admin · 18 comments
Owner

Originally created by @doctrinebot on GitHub (Mar 6, 2010).

Originally assigned to: @beberlei on GitHub.

Jira issue originally created by user @beberlei:

It should be allowed to overwrite the default persisters for collections and entities. This should go along the lines of Hibernate which allows to set the custom implementations like:

XML:

<entity persister="persisterClass" />
<OneToMany persister="persisterClass" />

Annotation

/****
 * @Entity(persister="persisterClass")
 * @OneToMany(persister="persisterClass")
 */
Originally created by @doctrinebot on GitHub (Mar 6, 2010). Originally assigned to: @beberlei on GitHub. Jira issue originally created by user @beberlei: It should be allowed to overwrite the default persisters for collections and entities. This should go along the lines of Hibernate which allows to set the custom implementations like: XML: ``` <entity persister="persisterClass" /> <OneToMany persister="persisterClass" /> ``` Annotation ``` /**** * @Entity(persister="persisterClass") * @OneToMany(persister="persisterClass") */ ```
admin added the New Feature label 2026-01-22 12:40:00 +01:00
Author
Owner
@doctrinebot commented on GitHub (Mar 6, 2010): - is duplicated by [DDC-3793: Unit Of Work - Proxy injected collections 'PersistentCollections'](http://www.doctrine-project.org/jira/browse/DDC-3793) - is referenced by [DDC-2637: [GH-769] Add Custom Persisters](http://www.doctrine-project.org/jira/browse/DDC-2637) - is referenced by [DDC-699: ProxyFactory: allow to overwrite $_proxyClassTemplate to allow custom criterias during execution of _load()](http://www.doctrine-project.org/jira/browse/DDC-699) - is referenced by [DDC-445: Evaluate possible ways in which stored procedures can be used](http://www.doctrine-project.org/jira/browse/DDC-445)
Author
Owner

@doctrinebot commented on GitHub (May 19, 2010):

Comment created by romanb:

Rescheduling for beta3.

@doctrinebot commented on GitHub (May 19, 2010): Comment created by romanb: Rescheduling for beta3.
Author
Owner

@doctrinebot commented on GitHub (Jul 7, 2010):

Comment created by romanb:

Pushing back to beta4.

@doctrinebot commented on GitHub (Jul 7, 2010): Comment created by romanb: Pushing back to beta4.
Author
Owner

@doctrinebot commented on GitHub (Jul 12, 2010):

Comment created by romanb:

Moved to 2.1 due to lack of time for any larger new features for 2.0.

@doctrinebot commented on GitHub (Jul 12, 2010): Comment created by romanb: Moved to 2.1 due to lack of time for any larger new features for 2.0.
Author
Owner

@doctrinebot commented on GitHub (Oct 13, 2010):

Comment created by @beberlei:

implemented this in a feature branch for now, it really doesnt touch any other runtime code so maybe we can still merge this before RC1

http://github.com/doctrine/doctrine2/tree/OverridePersisters

@doctrinebot commented on GitHub (Oct 13, 2010): Comment created by @beberlei: implemented this in a feature branch for now, it really doesnt touch any other runtime code so maybe we can still merge this before RC1 http://github.com/doctrine/doctrine2/tree/OverridePersisters
Author
Owner

@doctrinebot commented on GitHub (Feb 25, 2011):

Comment created by gediminasm:

Is this forgotten? you should merge it since it does not affect any other parts of ORM, this is a great feature

@doctrinebot commented on GitHub (Feb 25, 2011): Comment created by gediminasm: Is this forgotten? you should merge it since it does not affect any other parts of ORM, this is a great feature
Author
Owner

@doctrinebot commented on GitHub (Feb 26, 2011):

Comment created by @beberlei:

This has not been forgotten, but the Persister is due for a heavy refactoring for 2.2 probably, when we will make it use the SQL Query object that we are working on.

So I cannot merge this, because the API will probably break big time.

@doctrinebot commented on GitHub (Feb 26, 2011): Comment created by @beberlei: This has not been forgotten, but the Persister is due for a heavy refactoring for 2.2 probably, when we will make it use the SQL Query object that we are working on. So I cannot merge this, because the API will probably break big time.
Author
Owner

@doctrinebot commented on GitHub (Mar 16, 2011):

Comment created by jonaswouters:

Does that mean we will not see this feature before 2.2?

@doctrinebot commented on GitHub (Mar 16, 2011): Comment created by jonaswouters: Does that mean we will not see this feature before 2.2?
Author
Owner

@doctrinebot commented on GitHub (Mar 16, 2011):

Comment created by @beberlei:

Yes, that is correct. I dont want to add it as experimental/undocumented feature because people will take it for granted and make us responsible for possible bc breaks.

I will update the target version accordingly.

Sorry for disappointing you, but this feature is fundamentally important at the core of the library. That means we have to get it right and not rush into it.

@doctrinebot commented on GitHub (Mar 16, 2011): Comment created by @beberlei: Yes, that is correct. I dont want to add it as experimental/undocumented feature because people will take it for granted and make us responsible for possible bc breaks. I will update the target version accordingly. Sorry for disappointing you, but this feature is fundamentally important at the core of the library. That means we have to get it right and not rush into it.
Author
Owner

@doctrinebot commented on GitHub (Mar 17, 2011):

Comment created by gediminasm:

Just as I thought that first you will want to make a query builder object for all persisters. since now they use plain sql. Thanks for all your work on this

@doctrinebot commented on GitHub (Mar 17, 2011): Comment created by gediminasm: Just as I thought that first you will want to make a query builder object for all persisters. since now they use plain sql. Thanks for all your work on this
Author
Owner

@doctrinebot commented on GitHub (Jan 11, 2012):

Comment created by adambro:

I might be mistaken, but AFAICS mentioned Persister heavy refactoring did not made through to 2.2 version. Is there any plan to have it in 2.3 or at any later stage?

@doctrinebot commented on GitHub (Jan 11, 2012): Comment created by adambro: I might be mistaken, but AFAICS mentioned Persister heavy refactoring did not made through to 2.2 version. Is there any plan to have it in 2.3 or at any later stage?
Author
Owner

@doctrinebot commented on GitHub (Jan 13, 2012):

Comment created by @guilhermeblanco:

@Adam I refactored all Persisters optimizing their code, but I could not complete the move from SQL string generation to Doctrine\DBAL\Query.
We missed it, yes. I may reschedule for 2.3

@doctrinebot commented on GitHub (Jan 13, 2012): Comment created by @guilhermeblanco: @Adam I refactored all Persisters optimizing their code, but I could not complete the move from SQL string generation to Doctrine\DBAL\Query. We missed it, yes. I may reschedule for 2.3
Author
Owner

@doctrinebot commented on GitHub (Sep 5, 2012):

Comment created by burnred:

Why is it still missing in 2.3? I would require this for an extension that uses its own overridden entity persister and using a custom persister is the solution that you guys recomend for not overriding the entity manager.

@doctrinebot commented on GitHub (Sep 5, 2012): Comment created by burnred: Why is it still missing in 2.3? I would require this for an extension that uses its own overridden entity persister and using a custom persister is the solution that you guys recomend for not overriding the entity manager.
Author
Owner

@doctrinebot commented on GitHub (Sep 23, 2012):

Comment created by sstok:

Any change seeing this soon? I really need this for a security feature.

What is making this so hard? just adding an setEntityPersister($entityName, $object) should do the trick.
I don't need any fancy stuff, just a way to limit the fields in the SELECT list.

Edit: OK, I'm shot I CAN NOT overwrite the entity manager as the UnitOfWork is private!
Got any other idea?

@doctrinebot commented on GitHub (Sep 23, 2012): Comment created by sstok: Any change seeing this soon? I really need this for a security feature. What is making this so hard? just adding an setEntityPersister($entityName, $object) should do the trick. I don't need any fancy stuff, just a way to limit the fields in the SELECT list. Edit: OK, I'm shot I CAN NOT overwrite the entity manager as the UnitOfWork is private! Got any other idea?
Author
Owner

@doctrinebot commented on GitHub (Sep 24, 2012):

Comment created by st_koegel:

Any chance you could add this quickly? I need this feature urgently to complete an extension using a custom persister. Thanks in advance.

@doctrinebot commented on GitHub (Sep 24, 2012): Comment created by st_koegel: Any chance you could add this quickly? I need this feature urgently to complete an extension using a custom persister. Thanks in advance.
Author
Owner

@doctrinebot commented on GitHub (Jul 9, 2013):

Comment created by lfweijl:

What's the status on this issue?

@doctrinebot commented on GitHub (Jul 9, 2013): Comment created by lfweijl: What's the status on this issue?
Author
Owner

@jonag commented on GitHub (Mar 17, 2016):

Hello, do we have any official update about this issue? It would be a great addition to the project!

@jonag commented on GitHub (Mar 17, 2016): Hello, do we have any official update about this issue? It would be a great addition to the project!
Author
Owner

@toby-griffiths commented on GitHub (Nov 15, 2018):

Any news on this. I need to get @OrderBy({"relatedTerm.name" = "ASC"}) like functionality, unless someone can advise of a better way?

@toby-griffiths commented on GitHub (Nov 15, 2018): Any news on this. I need to get `@OrderBy({"relatedTerm.name" = "ASC"})` like functionality, unless someone can advise of a better way?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#484