[Cubicweb] About IPrevNextAdapters and related

St├ęphane Bugat stephane.bugat at free.fr
Fri Sep 14 09:33:14 CEST 2012

Dear all,

I was wondering if it was possible to use ITreeAdapters in some specific cases where there is actually no obvious tree relations.

Let's imagine we have persons that are in contact using the relation "X in_contact_with Y". For a given person X, I want him to be able to navigate through its contacts Y. The problem is that X and Y are of the same types, so a tree relation has no sense here -- except if we could define that the "parent" entity is a kind of RQL result set... But it seems that we cannot define an ITreeAdapter with a simple "tree_relation" here.

My question is: is it possible to define a specific IPrevNextAdapter in such cases? How could I select this Adapter not only on the instance (here ``is_instance('Person')``) but also on an RQL query (something like ``custom_rql = 'Any Y WHERE Y is Person, X is Person, X is_user U, X in_contact_with Y'`` where U is the current session user...)?
Afterwards the previous_entity() and next_entity() will be very easy to define.


More information about the Cubicweb mailing list