[DDC-391] Allow to specifiy custom Entity and Collection Persister classes Created: 06/Mar/10  Updated: 08/Sep/13

Status: In Progress
Project: Doctrine 2 - ORM
Component/s: ORM
Affects Version/s: 2.0-ALPHA4
Fix Version/s: 2.x
Security Level: All

Type: New Feature Priority: Minor
Reporter: Benjamin Eberlei Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 9
Labels: None

Issue Links:
Reference
is referenced by DDC-2637 [GH-769] Add Custom Persisters Open
is referenced by DDC-445 Evaluate possible ways in which store... Open
is referenced by DDC-699 ProxyFactory: allow to overwrite $_pr... Resolved

 Description   

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")
 */


 Comments   
Comment by Roman S. Borschel [ 19/May/10 ]

Rescheduling for beta3.

Comment by Roman S. Borschel [ 07/Jul/10 ]

Pushing back to beta4.

Comment by Roman S. Borschel [ 12/Jul/10 ]

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

Comment by Benjamin Eberlei [ 13/Oct/10 ]

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

Comment by Gediminas Morkevicius [ 25/Feb/11 ]

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

Comment by Benjamin Eberlei [ 26/Feb/11 ]

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.

Comment by Jonas Wouters [ 16/Mar/11 ]

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

Comment by Benjamin Eberlei [ 16/Mar/11 ]

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.

Comment by Gediminas Morkevicius [ 17/Mar/11 ]

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

Comment by Adam Brodziak [ 11/Jan/12 ]

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?

Comment by Guilherme Blanco [ 13/Jan/12 ]

@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

Comment by Thomas Rothe [ 05/Sep/12 ]

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.

Comment by sebastiaan stok [ 23/Sep/12 ]

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?

Comment by Stefan Kögel [ 24/Sep/12 ]

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

Comment by Lennart Weijl [ 09/Jul/13 ]

What's the status on this issue?

Generated at Sun Oct 26 00:49:34 UTC 2014 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.