Re: $this->this and avoiding circular references

php.internals

Andi Gutmans

20 years ago
Hey, re: limiting factor I don't completely disagree but then again, in most cases, it's possible to design the app in a way which resolves the problem. As to weak references, you could do weak references in PHP just by using the indirect property access. Might not be perfect but it's quite doable. Andi At 09:21 PM 12/8/2005, Alan Pinstein wrote:

Alan Pinstein

20 years ago
> re: limiting factor I don't completely disagree but then again, in > most cases, it's possible to design the app in a way which resolves > the problem.
Well, this is true, but then it would either: a) reduce the functionality of the object layer (by eliminating references to "parent") b) add unreasonable burden onto the client of the objects to "undo" the circular reference (having the client essentially "nullify" one half of the circular reference when done with the object -- I have used this method in the past to "hack" out the memory leak, but it's problematic because, well, you have to remember to do it!) The situation I am working with presently when using the excellent Propel (http://propel.phpdb.org) ORM solution, which is able to represent arbitrary DB structure (which are translated into Object Graphs) in PHP. Therefore, the idea of "designing around the problem" isn't really an option because it manages referential integrity of the objects and thus requires parent<->child "pointers".
> As to weak references, you could do weak references in PHP just by > using the indirect property access. Might not be perfect but it's > quite doable.
Awesome! Could you tell me what "indirect property access" is? I googled for it but there's nothing... Thanks, Alan