Forums / Setup & design / A definitive way to deal with object relations ? (how to associate an object and its related topics)

A definitive way to deal with object relations ? (how to associate an object and its related topics)

Author Message

Xavier Dutoit

Sunday 05 September 2004 6:11:45 am

Hi all,

I'm creating a NGO directory with the topics they work in. Eg. the "red cross" has several topics like "health" and "conflicts" and "Friends of the earth" has "environment".
- When I display a NGO, I want to list the topics they work in.
- When I display a topic, I want to list the related NGOs.

I've tought of/tried several datatypes to handle that, but I haven't found a 100% good one. What would you suggest ?

<b>ezSelection (with multiple choices)</b>
PROS:
- easy to create,
- can list the NGOs with fetch(+attribute_filter)
CONS:
- can't add attributes to the topic (eg a description, links to other sites...)

<b>object relation</b>
PROS:
- easy to create
- can have as many attributes as I want for the topic,
CONS:
- can't select more than one topic.
- Couldn't find a way to get a list of all the NGO associated with the topic "XXX"

<b>object relation list</b>
PROS:
- can have as many attributes as I want for the topic,
- can select more than one topic.
- can (could) let the user easily create a new topic from the form used to input a new NGO
CONS:
- can't filter on a class (eg topic) and parent node
- I need to customise the interface (the default one is too complicated,I just need a multiple choice list).
- Couldn't find a way to get a list of all the NGO associated with the topic "XXX"

<b>keyword</b>
I don't know where I can manage the list of keywords, nor how to list all the objects associated with a keyword.

<b>enum</b>
Seems to be deprecated by Selection.

<b>custom attribute based on the contrib category </b>
I don't feel its the right way, as I belive my need has the same pattern that a lot of sites.

<b>Conclusion/discussion</b>
So far the best way seems to create an "ez object multiple relation", based on the object relation list.
However, it doesn't solve the problem of listing all the objects linked to the item.
I haven't played with the fetch+attribute_filter with a object relation list attribute, but IMHO, it should exist an easier way of doing it.

Does ez miss a "bidirectionnal related object" ?

How have you implemented that on your sites ? (on a discussion in this forum, Paul mentionned a need like mine for books if I understood right).

Any idea or suggestion more than welcome.

Thanks in advance,

Xavier

http://www.sydesy.com

Brendan Pike

Monday 28 August 2006 1:27:07 am

Although an old topic I thought I would revive this as I have interest in knowing how others have handled this as eZ publish 3 has matured.

As a practicle example I am currently considering how to best organise a shop with school books. We will likely use multiple product classes for better control. The tree folder structure is something like this;

Teacher Learning
General Interest
Secondary
Middle Years
Primary
Early Childhood
etc.

Among the book class attributes we are considering:

* Year published, ie. 2005 (either Selection or Enhanced Selection single select)
* Reading Level, ie. 1-6 (either Selection or Enhanced Selection multi select)
* Category ie. Algebra, History, Calculus (either Selection or Enhanced Selection multi select)

I initially favoured Enhanced Selection for its advanced abilities but now wonder if its the best path because:
1. It appears attribute_filter can not be applied to Enhanced Selection, which means I should probably use Selection datatype instead although you can still not use Selection in multiple mode.
2. Class embedded category methods seem restricted when you wish to create multiple product classes.

Keywords may be a better choice, however there is the issue of not been able to easily control what keywords are used and I am not sure if attribute_filtering is possible with this. If anyone has good template hacks for this purpose please consider sharing them too.

I am keen to hear others opinions of what has worked for them.

www.dbinformatics.com.au

We are always interested in hearing from experienced eZ PHP programmers and eZ template designers interested in contract work.