Getting related objects with empty attributes / Locale pb

Author Message

Antoine W.

Tuesday 30 August 2005 8:43:10 am

Hi,

I just did a test of <i>related objects</i> and translations, with the following objects :

object#1 is available in english (<i>eng-GB</i>).
object#2 is available in english and translated in german (<i>ger-DE</i>).
object#1 is related to object#2.

I created a siteaccess for german, with <i>ContentObjectLocale</i> set to <i>ger-DE</i>.

When I try to display object#1, I get the english version of this object because german translation is not available - thats OK.

But when I try to display related objects to object#2, <i>$node.object.related_contentobject_array[0].main_node</i> will contain object#1 with every attributes <b>empty</b> (in data_map) instead of attributes in english version.
That's a strange behavior !
I thought that it would fetch automatically the attributes in english when there is no translation for the current locale.

Is it normal ? What can I do to display the english version of related objects, when not available in current locale ?

For the moment, I fetch again objects by nodeid from the related_contentobject_array, but it's really not optimised...

{let topic=$node.object.related_contentobject_array[0].main_node}
{* Here, every attributes in $topic.data_map will be EMPTY! *}

{set topic=fetch( content, node, hash( node_id, $topic.node_id ))}
{* Fetching it again, it will be ok : attributes in $topic.data_map will be in english *}

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 19 2025 04:30:41
Script start
Timing: Jan 19 2025 04:30:41
Module start 'layout'
Timing: Jan 19 2025 04:30:41
Module start 'content'
Timing: Jan 19 2025 04:30:43
Module end 'content'
Timing: Jan 19 2025 04:30:43
Script end

Main resources:

Total runtime1.8242 sec
Peak memory usage4,096.0000 KB
Database Queries46

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0202 589.3984152.6563
Module start 'layout' 0.02020.0031 742.054739.5078
Module start 'content' 0.02341.7993 781.5625408.6719
Module end 'content' 1.82270.0015 1,190.23448.2500
Script end 1.8242  1,198.4844 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00370.2034160.0002
Check MTime0.00140.0795160.0001
Mysql Total
Database connection0.00110.058910.0011
Mysqli_queries1.757696.3496460.0382
Looping result0.00080.0414440.0000
Template Total1.768196.920.8840
Template load0.00220.118420.0011
Template processing1.765996.805520.8830
Template load and register function0.00020.012310.0002
states
state_id_array0.00090.050510.0009
state_identifier_array0.00160.090220.0008
Override
Cache load0.00180.0971160.0001
Sytem overhead
Fetch class attribute can translate value0.00100.052410.0010
Fetch class attribute name0.00160.085710.0016
XML
Image XML parsing0.00010.006810.0001
class_abstraction
Instantiating content class attribute0.00000.000410.0000
General
dbfile0.00200.1095100.0002
String conversion0.00000.000440.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
1content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
3content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
2content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 9
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs