Forums / Developer / Problem for fetch related object with 3.9.2 version

Problem for fetch related object with 3.9.2 version

Author Message

Stéphane Bullier

Thursday 07 June 2007 10:02:35 am

Hello,

I have a object with several related object. I try to fetch them to use the parmeter 'attribute_identifier'.

{def $objects=fetch( 'content', 'related_objects',
                     hash( 'object_id',  $node.contentobject_id,
                     	   'attribute_identifier', 309 ) )}

{foreach $objects as $object}
    {$object.name|wash} <br />
{/foreach}

But the querry return nothing.

When I don't use the parameter it's work fine.

Any idea !!

Stéphane

Paul Leclercq

Friday 08 June 2007 8:22:11 am

You should add the "all_relations" parameter.

You can also try using the "class/identifier" insted of the ID of your related object's attribute:

{def $objects=fetch( 'content', 'reverse_related_objects',
			hash(
				'object_id', $node.contentobject_id,
				'all_relations',false(),
				'attribute_identifier', 'class/attribute'
			) )}

Stéphane Bullier

Friday 08 June 2007 9:22:02 am

Hello Paul,

Thank for you reply. But It's not working. I try to use :

{def $tableau_partenaire=fetch( 'content', 'related_objects',
                     hash( 'object_id',  $node.object.id,
                     		'all_relations', attribute,
                     	   'attribute_identifier', '376' ) )}

without success.

Help !!

Stéphane

Maurizio Betti

Friday 22 June 2007 5:27:52 am

I find the same problem on 3.9.2 using reverse_related_objects:

{def $objects=fetch( 'content', 'reverse_related_objects', hash( 'object_id', $node.contentobject_id, 'all_relations', true ) )}

the $objects array results be void.

On the other side I'm sure reverse related object exist 'cause I can see them from Admin interface.

Any idea to solve it?

Best regards

Maurizio Betti
http://www.arsweb.it
http://www.hospes.it

Maurizio Betti

Friday 22 June 2007 5:41:54 am

ok,

I found it runs only specifing the 'attribute_identifier' parameter...but what about dont'use it?

Maurizio Betti
http://www.arsweb.it
http://www.hospes.it

André R.

Friday 22 June 2007 6:44:01 am

Stéphane Bullier: try setting 'attribute_identifier' as a integer instead of a string

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

Stéphane Bullier

Monday 02 July 2007 6:29:09 am

Hello,

Thank you André.

I solve my problem. I made a mistake of "attribute_identifier" of my class.

Stéphane

Luc Chase

Friday 06 July 2007 8:40:46 am

Did you get this working without the group_by_attibute parameter set to true() ?

The Web Application Service Provider

Stéphane Bullier

Monday 06 August 2007 12:56:50 am

Hi Luc,

I use :

'group_by_attribute',   false()

Stéphane

John Kazakis

Monday 16 June 2008 8:39:17 am

Hello,

I've tried to use reverse_related_objects, to fetch a list of articles for the current author,

This is the code that I'm currently using, now the problem with this is that if the article written by an author has different locations, all locations are shown, so I have the same article showing 3 or 4 times in the same page.

Is there something like 'main_node_only' for reverse_related_objects, or do I have to install an extension or a template plugin?

Below is the code that I am using,

{if $node.node_id|eq($node.node_id)}
		{def $objects=fetch( 'content', 'reverse_related_objects',
                   		  hash( 'object_id', $node.contentobject_id,
					'all_relations', true(),
					'group_by_attribute',  false(),
	                                'ignore_visibility', false(),
					'sort_by',	 array('published', false()) ))}
		{foreach $objects as $object}
<a href={$object.main_node.url_alias|ezurl()}>{attribute_view_gui attribute=$object.data_map.full_name}</a>
		{/foreach} 									
{/if}

Thanks,
John.