[DDC-1332] Specify Custom ProxyFactory Created: 15/Aug/11  Updated: 18/Feb/14

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

Type: New Feature Priority: Minor
Reporter: Eric Clemmons Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 1
Labels: None


 Description   

My tweet:

> @beberlei Have you heard of overriding the ProxyFactory to allow caching of lazy-loaded entities? Trying to do that now

The majority of our data is quite stagnant and so I was shoehorning the capability of the generated proxies to use a custom class.

My new proxy, in short, will lazy-load the data as normal the first time around, but also stores it in Memcache using an injected adapter. Upon subsequent lazy-loading, memcache is used rather than a call to the DB.

I can't decide if this is better suited for the EntityPersister (which has already been discussed at length), but it seems to fits nicely with a custom proxy.



 Comments   
Comment by Benjamin Eberlei [ 15/Aug/11 ]

This is the wrong extension point to override the proxy factory. It should be in the persisters.

Comment by Eric Clemmons [ 15/Aug/11 ]

Ah, so my doubts were well founded.

The branch allowing custom EntityPersisters has not been merged in yet, has it? Or, a better question, will it be? That will dicate if I need to maintain a separate fork for this functionality or find other means to handle this.

I know how hesitant we were for adding any extension point, because then we feel we have to support it, which makes me wonder if "LifeCycleCallback::preFetch" or similar is a potential alternative.

Comment by Christian Schmidt [ 18/Feb/14 ]

Related: https://github.com/doctrine/doctrine2/pull/243

Generated at Fri Oct 31 22:27:16 UTC 2014 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.