[support] refer/retrieve/save grandparent in child node without parent's node load

Ted ted-drupalists at webfirst.com
Tue Mar 15 17:09:42 UTC 2011


The answer to resource intensive processes is usually caching of some 
kind. For your case, you might consider using the computed_field module 
to add a "ref_a" field on C, which gets stored in the content_type_C 
table. By default, this field is only updated when a C is saved. If your 
workflow requires it, you can use Node API or Rules to update the 
appropriate C nodes whenever a B (or A) node is updated, basically 
performing node_save(node_load($nodeid_of_c)).

Ted

On 3/15/2011 12:16 PM, Benjamin Jacob wrote:
> Couldn't think of an easier subject line :-)
>
>
> I have three node types
> A ->  B ->  C
> A<- B<- C
>
> where A refers B and B refers C (and there's CNR for backwards).
>
> Now when displaying content from C, i would want to display A's titles (atleast). Is there a way where I can refer A as well in C because of the reference to B?
> This so that while displaying C, I don't have to load B's entire content and then retrieve A.
> C can have unlimited number of references to B. So loading B within C is not such a good idea.
>
> I hope you are not at c when reading this :-)
>
> All help really appreciated.
>
> Regards
> - Ben
>
>
>
>
>



More information about the support mailing list