[DDC-1076] It should be possible to supply EntityManager with a custom ProxyFactory Created: 24/Mar/11  Updated: 25/Mar/11

Status: Open
Project: Doctrine 2 - ORM
Component/s: ORM
Affects Version/s: None
Fix Version/s: None
Security Level: All

Type: Improvement Priority: Trivial
Reporter: David Reisch Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 2
Labels: None


 Description   

It is plausible that one might want to handle the loading of proxy classes in their own way, perhaps not using the filename/class scheme doctrine currently comes with.

Currently the only way to provide your own implementation of ProxyFactory is to subclass EntityManager. Even this is not clean since one also must copy/paste the EntityManager::create factory method to get identical behavior.

It would be nice if there was a ProxyFactory interface and one could provide an instance of it to Doctrine\ORM\Configuration when creating an EntityManager.



 Comments   
Comment by David Reisch [ 24/Mar/11 ]

I would be happy to contribute a patch to this end.

Comment by Benjamin Eberlei [ 25/Mar/11 ]

Can you elaborate on your use-case? proxies are sorft of a by product, to be genreated in a temporary cache directory. I don't see why one should bother about how it is done.

Comment by David Reisch [ 25/Mar/11 ]

Hi,
I think allowing users to specify their own implementations for things is pretty essential for a library, especially when there is no cost in complexity or implementation.

Anyhow, here's my pitch:

I personally do not like using inheritance for proxies (it feels hackish to me), preferring instead to have interfaces for my Business Objects which the proxies implement. To that end, I do not generate my proxies with doctrine, but maintain my own, in my code base, and the class files do not necessarily match up to the doctrine ProxyFactory's assumptions about where to find the classes.

Regards,

Generated at Fri Aug 01 06:06:26 UTC 2014 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.