Forums / General / Object Relations / Comment32108

Author Topic

Roberto Kirschbaum

Wednesday 24 August 2005 6:51:05 am

Comment32108

Felipe,

Thanks for the hint! But please read on...

Xavier,

When I did the association by hand, and only then, did the fetch function suggested by Felipe work. Also, only then was I able to see on the admin interface the author as a related object and book as a reverse related object on the author. So I guess you are right about "the reverse related function on the kernel (on 3.6) might avoid the relations when the attribute_id is set (wasn't the case in 3.5.x)" but I wouldn't know how to patch the kernel at my present knowledge level.

So any opinions on what I should do? Should I do the association by hand? Should I wait for a patch?

One last interesting clue: this is how I did make it work, so when accessing an Author's page, I can see links to his books:

        {def $sAuthorId=$node.object.id}

        {* Fetch all books from Books folder (Folder.node_id=110)*}
        {let books=fetch( content,
                             list,
                             hash( parent_node_id, 110,
                             sort_by, $node.sort_array
                             )
                           )
        }
        {foreach $books as $thisbook}
          {def $authors=$thisbook.object.data_map.authors.content.id_list}
            {foreach $authors as $thisauthor}
              {if eq($thisauthor,$sAuthorId)}
                {* Display a link to the book. *}
                 <a href={concat('/content/view/full/',$thisbook.node_id)|ezurl}>{$thisbook.object.name}</a><BR />
              {/if}
            {/foreach}
          {undef $autores}
        {/foreach}
        {undef}
        </td>