reverse_related_objects multiple categories, IDs or some other solution

Author Message

Ivan Švogor

Thursday 04 November 2010 8:21:22 am

Hello,

I've added object relations to my Article class. Now, I can have categories (as is suggested in some manual). And now, I would like to list articles by this relatet object. So I use reverse_related_objects function in my template. And it's ok. It works, I get articles that are in category I want to see. This is controled by object_id parameter.

But now, I have articles that are related to two, or more classes (or categories). Now, I cannot use reverse_related_objects any more becouse object_id parameter is integer, not an array.

My question is how can I get this working. Article with related object class, a few custom classes representing categories, and now I want to list all articles that are related to multiple object, or categories. (I need them to be mixed, becouse list with first category A, than B, than C.. that would be messy)

I would appriciate any ideas or suggestions. Thanks!

Ilya Sazonov

Saturday 06 November 2010 6:09:02 am

The answer is quit using reverse_related_objects . You can use fetch('content','list' ... . But to make it serve your purpose you should use extended_attribute_filter 'ObjectRelation' which can be found in the following extension

http://projects.ez.no/objectrelationfilter

Maybe it's present out of the box now, i'm not sure, read this

http://projects.ez.no/objectrelationfilter/news/moving_objectrelationfilter_from_contribs

My eZpublish version is 4.0.1, so I had to install an extension, but it was worth it.

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 31 2025 00:29:49
Script start
Timing: Jan 31 2025 00:29:49
Module start 'layout'
Timing: Jan 31 2025 00:29:49
Module start 'content'
Timing: Jan 31 2025 00:29:49
Module end 'content'
Timing: Jan 31 2025 00:29:49
Script end

Main resources:

Total runtime0.0243 sec
Peak memory usage8,192.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0050 588.6094151.2734
Module start 'layout' 0.00500.0039 739.8828220.7578
Module start 'content' 0.00890.0137 960.6406997.6641
Module end 'content' 0.02260.0017 1,958.304729.9766
Script end 0.0243  1,988.2813 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002510.3031140.0002
Check MTime0.00104.0710140.0001
Mysql Total
Database connection0.00083.396710.0008
Mysqli_queries0.00218.826030.0007
Looping result0.00000.082410.0000
Template Total0.00125.110.0012
Template load0.00093.742210.0009
Template processing0.00031.296510.0003
Override
Cache load0.00062.662610.0006
General
dbfile0.00156.192880.0002
String conversion0.00000.028540.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs