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.

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 20 2025 05:16:02
Script start
Timing: Jan 20 2025 05:16:02
Module start 'layout'
Timing: Jan 20 2025 05:16:02
Module start 'content'
Timing: Jan 20 2025 05:16:03
Module end 'content'
Timing: Jan 20 2025 05:16:03
Script end

Main resources:

Total runtime1.1811 sec
Peak memory usage4,096.0000 KB
Database Queries54

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0056 590.8125152.6875
Module start 'layout' 0.00570.0034 743.500039.5859
Module start 'content' 0.00911.1706 783.0859548.4063
Module end 'content' 1.17970.0014 1,331.492212.0156
Script end 1.1811  1,343.5078 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00340.2875160.0002
Check MTime0.00160.1336160.0001
Mysql Total
Database connection0.00070.060810.0007
Mysqli_queries1.113794.2917540.0206
Looping result0.00050.0453520.0000
Template Total1.138196.420.5691
Template load0.00190.158820.0009
Template processing1.136296.199220.5681
Template load and register function0.00010.008810.0001
states
state_id_array0.00210.173610.0021
state_identifier_array0.00170.143420.0008
Override
Cache load0.00170.1423650.0000
Sytem overhead
Fetch class attribute can translate value0.00070.055220.0003
Fetch class attribute name0.00140.116630.0005
XML
Image XML parsing0.00080.064320.0004
class_abstraction
Instantiating content class attribute0.00000.000630.0000
General
dbfile0.00210.1808160.0001
String conversion0.00000.000740.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/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
2content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
13content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
11content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 29
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs