Reverse Object Relations

Author Message

josh rowley

Wednesday 30 January 2008 5:04:54 am

Hi!

I'm looking for a way to fetch a list of objects by reverse object relation ( multi select ).

So, currently I have an objectrelations attribute within a series of objects I want to search for, that points to a subtree. I want to be able to pass a list of node ids from that subtree to a fetch function that will return objects which are related to all of the node ids that are requested.

Now, I see that you cannot do attribute filtering with the objectrelations datatype. Does the enhanced object relations do what I want, do I need a SQL filter, or can anyone make any other suggestions of how I might achieve this, or how it has been solved in the past?

Many Thanks!

Felix Laate

Wednesday 30 January 2008 11:54:17 am

Hi Josh!

Welcome to the community!

A good place to start would be here:

http://ez.no/doc/ez_publish/technical_manual/4_0/reference/modules/content/fetch_functions/reverse_related_objects

This function supports attribute filtering as well.

Cheers!

Felix

Publlic Relations Manager
Greater Stavanger
www.greaterstavanger.com

josh rowley

Thursday 31 January 2008 1:56:37 am

Thanks Felix!

However, I have seen that document already and it doesn't look like I can fetch by multiple relations.

The only way I can see to do this, as underneath the objectrelations datatype uses XML in the data_text field to store the relations, is to do multiple fetches ( one per relation I want to match on ) and then build an array of node_ids that have objects which match all 3 requests.

Pretty inefficient.. Another way I can think is to create a new datatype which uses the object link table instead of XML.. but I wonder if there are any solutions out there which will already work with a simple fetch using attribute filters.

Josh

André R.

Thursday 31 January 2008 3:27:50 am

object relationlist already use the object link table, look at this extension for code (it uses the extended object attribute filter for relations filtering).

Relations filter ( comment by Kristof Coomans ):
http://ez.no/developer/contribs/template_plugins/objectrelationfilter

Reverse relations filter:
http://pubsvn.ez.no/community/trunk/extension/objectrelationfilter/classes/objectrelationfilterandinv.php

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

John Kazakis

Thursday 12 June 2008 8:49:54 am

Hello,

Is there a way to fetch reverse_related_objects AND related_objects? Or do I have to use 2 separate fetches?

Thanks.

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