Forums / Developer / ObjectRelationList with fetch function

ObjectRelationList with fetch function

Author Message

Lars Eirik R

Monday 26 July 2010 6:11:29 am

Hi.

I have encountered a problem of mine with regards to the fetch function for object relations.

I have two languages : norwegian and english.

I have one attribute called people which is a objectrelationlist.

I have 4 objects currently stored in the people attribute for tthe norwegian translation of the object, and only two people in the english list.

The problem is that the english page displays all 4 people as long as they do exist as translated objects in the system.

The goal is for me to be able to say to the editor that each country should be free to display its own preferred listing of people.

Surely this must be possible?

Thiago Campos Viana

Monday 26 July 2010 3:38:23 pm

Hi

You have to change [RegionalSettings] in settings/siteaccess/(nor|eng|othersiteaccess)/site.ini.append.php

You may have something like:

[RegionalSettings]
Locale=eng-GB
ContentObjectLocale=eng-GB
ShowUntranslatedObjects=enabled
SiteLanguageList[]

SiteLanguageList[]=eng-GB
SiteLanguageList[]=por-BR
TextTranslation=enabled

You may change these settings to something like:

[RegionalSettings]
Locale=eng-GB
ContentObjectLocale=eng-GB
ShowUntranslatedObjects=disabled
SiteLanguageList[]

SiteLanguageList[]=eng-GB
TextTranslation=enabled

For each siteaccess, according to your needs.

eZ Publish Certified Developer: http://auth.ez.no/certification/verify/376924

Twitter: http://twitter.com/tcv_br

Lars Eirik R

Monday 26 July 2010 10:21:27 pm

Thanks for the reply Thiago..

I already have the setting you suggest however.

in my template i do the following: {def $relatedobjects=fetch('content', 'related_objects', hash('object_id',$node.contentobject_id, 'attribute_identifier','frontpage/people' ) )}

when i loop through the $relatedobjects it seems that the list is filled with all results from both the norwegian and the english edit of the object.

Basically i have added 5 people objects to my people list when i edit in norwegian.

person a=john (exists in english and norwegian)

person b=mary(exists in english and norwegian)

person c=kate(exists in english and norwegian)

person d=bob(exists in english and norwegian)

person e=peter(exists only in norwegian)

For my english version i only want three of these people to be displayed.

english version of the people attribute list is populated with person a and person b and person e.

I would like to only have John,Mary and Peter displayed on my english siteaccess.

The results however is all people that do exist in one of the versions of the attribute people. (either english or norwegian)

Note that this only happens if the 5 people objects in the norwegian version of the attribute have been translated to english, therefore it appears that peter does not show up in the english list.

Could anyone please reproduce this on their installation with similar ways of relating content?

Thiago Campos Viana

Tuesday 27 July 2010 5:09:18 am

So, it could be a bug as related in http://issues.ez.no/IssueView.php?Id=17038&ProjectId=3

eZ Publish Certified Developer: http://auth.ez.no/certification/verify/376924

Twitter: http://twitter.com/tcv_br

Lars Eirik R

Tuesday 27 July 2010 6:15:41 am

this does not have to to with edit of the list , it has to do with the objects returned from the fetch as far as i understand..

thanks.

Lars Eirik R

Wednesday 28 July 2010 3:28:18 am

anybody else that can help out with this issue? Can i use the object relation list as i want to, or is this not supported?

Lars Eirik R

Wednesday 28 July 2010 4:27:25 am

to me it looks like the fetch function is not working as i hope. After having dealt with this , i realize that the only way to fetch correct values is to investigate the node object like this: $node.data_map.peoplelist.content.relation_list.

This gives me a reference to arrays which contains the actual ids for my current language.

Using these objectids i may use the following for each of the ids in the array..

fetch( 'content', 'object', hash( 'object_id', object_id )

eZ debug

Timing: Jan 18 2025 18:14:31
Script start
Timing: Jan 18 2025 18:14:31
Module start 'content'
Timing: Jan 18 2025 18:14:32
Module end 'content'
Timing: Jan 18 2025 18:14:32
Script end

Main resources:

Total runtime1.0162 sec
Peak memory usage4,096.0000 KB
Database Queries207

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0073 587.8125180.8281
Module start 'content' 0.00740.8789 768.6406613.2578
Module end 'content' 0.88620.1299 1,381.8984341.0859
Script end 1.0161  1,722.9844 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00430.4236210.0002
Check MTime0.00160.1561210.0001
Mysql Total
Database connection0.00120.117910.0012
Mysqli_queries0.916590.19552070.0044
Looping result0.00240.23252050.0000
Template Total0.986897.120.4934
Template load0.00200.194220.0010
Template processing0.984896.912520.4924
Template load and register function0.00030.034210.0003
states
state_id_array0.00140.139110.0014
state_identifier_array0.00130.127220.0006
Override
Cache load0.00170.1722760.0000
Sytem overhead
Fetch class attribute can translate value0.00140.133030.0005
Fetch class attribute name0.00150.152390.0002
XML
Image XML parsing0.00140.142430.0005
class_abstraction
Instantiating content class attribute0.00000.0031140.0000
General
dbfile0.00390.3841330.0001
String conversion0.00000.000730.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

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
7content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
7content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
11content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
7content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
7content/datatype/view/ezxmltags/strong.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/strong.tplEdit templateOverride template
1content/datatype/view/ezxmltags/link.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/link.tplEdit templateOverride template
1content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 43
 Number of unique templates used: 9

Time used to render debug report: 0.0002 secs