php - Replace objects by other objects in-place -


suppose i'd build database abstraction layer, uses lazy loading mechanism.

if ask layer load root object, loads external representation , constructs itself.

it somehow identifies linked objects exist. since might costly load up-front, established proxies related objects. such proxies should able passed around.

if first message called on such proxy, loads external representation , constructs itself. since references proxy may have been passed around, created object needs replace existing proxy-object in-place.

can in-place replace object object in php?

i don't believe it's possible object replace references object. instead, have proxy objects forward property access , method invocation using overloading. implement proxying on base proxy object (named e.g. ooproxy), extend lazyproxy class lazily loads proxied object. long don't need examine type of object, has reference proxy won't able distinguish proxied.


Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -