Implementing Many To Many Relationships

Author Message

Joe Simms

Tuesday 28 February 2006 11:57:24 am

Hi

I have been reading your documentation all day and finally am coming to grips with how this system comes together. From what I understand, the following is how someone would implement a many to many relationship:

Create a class called readers
Create a class called books

A reader can have more than one book and a book can have more than one reader.

So i want to:

1. See what books a reader has read, and also what readers have read a particular book.
2. Allow readers to select new books, and this reference is created

So when creating objects for these must i do the following:

Create a node that represents each reader object, and then add child nodes to these representing the relevant books.

Then also create nodes that represent each book, and then add child nodes to these representing the relevant readers.

This seems a little time consuming with the double entry.

I don't understand how your object relation datatype works, but maybe to achieve the above i create an additional content class with two attributes, one that relates to a particular book and the other that relates to a particular reader. If this is the case, then how is this searchable in the admin / filtered in the admin section?

How do i then create a page that will allow registered to users to checkout books and then store this request.

Many thanks

Joe

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 06:21:33
Script start
Timing: Jan 31 2025 06:21:33
Module start 'layout'
Timing: Jan 31 2025 06:21:33
Module start 'content'
Timing: Jan 31 2025 06:21:33
Module end 'content'
Timing: Jan 31 2025 06:21:33
Script end

Main resources:

Total runtime0.0114 sec
Peak memory usage2,048.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0047 588.2266151.2109
Module start 'layout' 0.00470.0019 739.437536.6484
Module start 'content' 0.00650.0036 776.085990.0156
Module end 'content' 0.01010.0012 866.101629.9922
Script end 0.0113  896.0938 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002218.9902140.0002
Check MTime0.00108.5483140.0001
Mysql Total
Database connection0.00097.712810.0009
Mysqli_queries0.001714.907130.0006
Looping result0.00000.079810.0000
Template Total0.00108.510.0010
Template load0.00076.312610.0007
Template processing0.00022.114010.0002
Override
Cache load0.00054.209110.0005
General
dbfile0.00021.962880.0000
String conversion0.00000.063040.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