Forum OpenACS CMS: Re: Learning from what others do well

Collapse
Posted by Jun Yamog on
Hi Mark,

No article about relationships.  You can look at bcms on the cvs contrib.  It already uses relations.

In a nutshell here is how CR relations works.  From what I remember we have like object_one_id (the parent), object_two_id (the related content) and relation (what their relationship is).  I think there is also a order column.

Anyway for example we have article and want to relate some images on it.  So the object_id of the article is object_one_id and the object_ids of the different images are object_two_ids.  Then you give them a reasonable relationship like "images".  You will have to add each relation for each image.  So if you have the article, all you have to do is the query cr_relations (not sure, just from memory) using the article object_id as object_one_id and relation "images" you will end up with object ids of the images related to that article.

As for the live revision stuff, if you are pertaining to CCM data model is simplier.  One one side it is, atleast getting the live revision.  But on the other side it is not.  a cr_live_revision may not be really needed.  You just have to join a cr_items.live_revision to cr_revisions.revision_id.