Partly initialization #380
Comments
|
Partial loading is only possible with a ghost object, although I didn't implement it fully yet, and I'm unsure about the proper interface for now. You probably want exactly what @lstrojny wants in #377 There is one way to achieve that, although it is very hacky and not formalised. As you can see in the initializer signature, a method and a parameter list is available. If you check for usages of I will at some point have to implement partial loading, as I really want the feature for Doctrine ORM too. |
|
Thank you for your fast reply. Apparently you have planned to implement partial loading in future, so I can wait with this performance issue because it has not a high priority. The important thing is that it works and it works like a charm. Maybe it will reduces complexity in future if you could provide a way to use objects as initializer. Closures could be used for less complex and classes for more complex initialization logic. Thank you very much. |
That's the plan for a later version: since PHP anonymous classes are now available, I want to interface the initializer. Ref: #334 |
|
That's a good idea. Then I will use your library without worries. |
|
Note: the initializers are now interfaced correctly, although through psalm annotations. ProxyManager/src/ProxyManager/Factory/LazyLoadingGhostFactory.php Lines 78 to 84 in f65ae0f |

Formed in 2009, the Archive Team (not to be confused with the archive.org Archive-It Team) is a rogue archivist collective dedicated to saving copies of rapidly dying or deleted websites for the sake of history and digital heritage. The group is 100% composed of volunteers and interested parties, and has expanded into a large amount of related projects for saving online and digital history.

Amazing and interesing project. I want to integrate your ProxyManager implementation into my project. However, I have a question about initialization of ValueHolderProxies. Is there any way to do a partly initialization depending on special use cases?
My use case:
I have a tree of objects.
An object within the tree can be obtained by creating a virtual proxy. Each object has parent / child relationships to other objects and some other properties which should be initialized immediately. At the moment when an object will be obtained, a proxy for the object itself and proxies for the directly parent and child objects are created. So my question is: Is there any way to create these parent / child proxies if they are explicitly needed (e.g. if getParent is called) ?
Best regards
The text was updated successfully, but these errors were encountered: