| Author | Message | 
                                                                                                    
                                                        | Aleksander Lech
                                                                                                                             
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     | Wednesday 04 January 2006 2:12:11 am 
                                                                
                                                                 Hi there I made custom class (A) and put ezobjectrelationlist attribute there.  Then, I created another custom class (B) and populate both with sample data. Now - object of class A contains object of class B. If I understand it correctly - object of class B is related to object of class A. I'm trying to display reverse relation - I mean display object of A in object of class B template file using: 
{* 189 is $node.contentobject_id *}
{def $objects=fetch( 'content', 'reverse_related_objects',
                     hash( 'object_id', 189 ) )}
{$objects|attribute('show')}
{foreach $objects as $object}
    {$object.name|wash} <br />
{/foreach}
And as you probably guess, it returns nothing. :( | 
                                                
                                                                                                                                                        
                                                        | Aleksander Lech
                                                                                                                             | Wednesday 04 January 2006 2:32:53 am 
                                                                 
I found something weird:This SQL is generated according to reverse_related_objects fetch:
 
SELECT DISTINCT
    ezcontentobject.*
FROM
    ezcontentobject, ezcontentobject_link
WHERE
    ezcontentobject.id=ezcontentobject_link.from_contentobject_id
AND
    ezcontentobject.status=1
AND
    ezcontentobject_link.to_contentobject_id=285
AND
    ezcontentobject_link.from_contentobject_version=ezcontentobject.current_version
AND
    contentclassattribute_id=0
What is the reason of last two lines? Without it, SQL returns correct data.  | 
                                                                                                    
                                                        | Massimiliano Bariola
                                                                                                                             | Wednesday 04 January 2006 2:33:25 am 
                                                                 Hi Alex, no, a "contains" relationship is not a "relation" relationship. think about the first as folder/file , and the second as "link from A to B". in admin view, contianed entities are shown indented with respect to their container, as a hiaerarchical tree. Related objects are shown under the detail of the object (lower-center part of the page). at any rate, try to add a  
{$object|attribute(show, X)}
with X = depth of inspection (1 ..... infinite) within your loop and see what exactly object contains. HTH Max | 
                                                                                                    
                                                        | Aleksander Lech
                                                                                                                             | Wednesday 04 January 2006 2:47:46 am 
                                                                 
Hi Massimiliano,I did:
 
{$objects|attribute('show',2)}
But it returns just table header: Attribute 	Type 	Value
 And nothing more | 
                                                                                                    
                                                        | Aleksander Lech
                                                                                                                             | Wednesday 04 January 2006 3:29:32 am 
                                                                 Gotcha! 
I make it work :) and here's the difference:Doesn't work:
 
{def $objects=fetch( 'content', 'reverse_related_objects',
                     hash( 'object_id', $node.contentobject_id) )}
Works: 
{def $objects=fetch( 'content', 'reverse_related_objects',
                     hash( 'object_id', $node.contentobject_id,
                            'attribute_identifier', 410) )}
'410' is id of attribute which I wanted to show, but I wonder - if there is a way to display ALL reverse-related objects? Aleksander | 
                                                                                                    
                                                        | Xavier Dutoit
                                                                                                                             | Thursday 05 January 2006 3:01:31 am 
                                                                 Hi, 
Have a look at this discussion that occured when building the fetch method you're using:http://ez.no/community/forum/general/object_relations
 Kristof came up with an extension that solved most of the problems: http://ez.no/community/contribs/hacks/advanced_content I don't remember the details, but I'm sure having a look at it will brings you the solution. Keep us informed about how you've solved your pb. X+ http://www.sydesy.com
                                                                 | 
                                                                                                    
                                                        | Kristof Coomans
                                                                                                                             | Thursday 05 January 2006 3:18:24 am 
                                                                 You can use the "all_relations" parameter if your Exponential version is up to date. I don't exactly know when it was added. For more information, see http://pubsvn.ez.no/nextgen/trunk/doc/features/3.6/related_objects_fetch_functions.txt independent eZ Publish developer and service provider | http://blog.coomanskristof.be | http://ezpedia.org
                                                                 | 
                                                                                                    
                                                        | Xavier Dutoit
                                                                                                                             | Thursday 05 January 2006 4:14:03 am 
                                                                 Now that Kristof mention it, he came with the solution with a patch more than an extension. Resolution for next year: do something to improve my memory ;) X+ http://www.sydesy.com
                                                                 | 
                                                                                                    
                                                        | Kristof Coomans
                                                                                                                             | Thursday 05 January 2006 7:10:49 am 
                                                                 No, you were right, my temporary solution was an extension ;-) independent eZ Publish developer and service provider | http://blog.coomanskristof.be | http://ezpedia.org
                                                                 |