Forums / Setup & design / Problem with reverse_related_objects fetch function

Problem with reverse_related_objects fetch function

Author Message

Daniele Nocentini

Thursday 09 March 2006 2:59:23 am

I have strange problem with the reverse_related_objects fetch function, if I try to find a speficic product in my content structure with this code:

{def $objects=fetch( 'content', 'reverse_related_objects',
                     hash( 'object_id', 185,
                           'attribute_identifier', '279',
						   'limit', 1 ) )}
 
{foreach $objects as $object}
    {section show=$object.id|eq('1355')}
	{$object|attribute(show)} <br />
	{/section}
{/foreach}

otherwise if I try to find the same product with the node fetch function, this is my code:

{def $my_node=fetch( 'content', 'node', hash( 'node_id', 1147 ) )}
{$my_node|attribute(show)}

 

The problem is the data_map array, with the first method is empty instead with the second method contain 19 element.
It's a my code problem or it's a bug?

Antica Bottega Digitale srl
http://www.abd.it

Daniele Nocentini

Friday 10 March 2006 2:43:43 am

Please someone can Help me?

Antica Bottega Digitale srl
http://www.abd.it

Marc Boon

Friday 10 March 2006 8:41:14 am

In your first example, you fetch the reverse related objects of the object with object_id 185, and then only show something if the found object has id 1355.

In the second example you fetch a node with node_id 1147

They are two completely different things.
No wonder you get different results.