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.

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 18 2025 15:01:28
Script start
Timing: Jan 18 2025 15:01:28
Module start 'layout'
Timing: Jan 18 2025 15:01:28
Module start 'content'
Timing: Jan 18 2025 15:01:29
Module end 'content'
Timing: Jan 18 2025 15:01:29
Script end

Main resources:

Total runtime0.9528 sec
Peak memory usage4,096.0000 KB
Database Queries86

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0052 588.0625152.6406
Module start 'layout' 0.00520.0027 740.703139.4766
Module start 'content' 0.00780.9434 780.1797776.1875
Module end 'content' 0.95130.0014 1,556.367224.1250
Script end 0.9527  1,580.4922 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00380.3963160.0002
Check MTime0.00140.1461160.0001
Mysql Total
Database connection0.00080.081610.0008
Mysqli_queries0.865390.8207860.0101
Looping result0.00090.0940840.0000
Template Total0.919096.520.4595
Template load0.00260.269920.0013
Template processing0.916596.188720.4582
Template load and register function0.00010.010510.0001
states
state_id_array0.00090.098410.0009
state_identifier_array0.00170.177120.0008
Override
Cache load0.00210.2234580.0000
Sytem overhead
Fetch class attribute can translate value0.00080.083960.0001
Fetch class attribute name0.00130.1365140.0001
XML
Image XML parsing0.00310.322160.0005
class_abstraction
Instantiating content class attribute0.00000.0035180.0000
General
dbfile0.00310.3253340.0001
String conversion0.00000.000840.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
8content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
10content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
14content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
6content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 41
 Number of unique templates used: 7

Time used to render debug report: 0.0002 secs