Skip to content

References and related

uwej711 edited this page Mar 25, 2011 · 1 revision

while thinking about references,children and parent I had a look at the other ODMs proxy classes. They are generated as sub classes of the documents and store just the id. All methods of the document are overridden and ensure that the instance gets "refreshed" via the stored id (btw. does that still work when you annotate public properties?).

Now PHPCR methods to access children, parent and references already return the node instances. While we could simply throw them away and just keep the path (or id?) in the proxy I think it would make more sense to keep the node in the proxy (if Jackalope already caches the node it wouldn't make a big difference regarding performance extracting the path/id and asking for the node again).

Managing references should be easy as @ReferenceOne maps to a single valued property of type reference or weakreference while @ReferenceMany is just the same multivalued. For the other side of the relation we can have a @Referer annotation. To be on the save side referable nodes should declare this in the @Document so that we can add the proper mixin at node creation.

Clone this wiki locally