Search

Hi everyone,

it's the first time I post on the Symphony's forum and — before all — I need to express my gratitude in creating such a beautiful piece of software: simple, elegant, expandable and very easy to use. Thanks @eKoeS for introducing me to Symphony!

Here is the question.

I'm looking for best practices in creating many-to-many relationships between sections with additional fields on the relationship. Take the recipe-ingredient as an example: when I add an ingredient to a recipe I also need to add quantity.

Is there some known examples of structure like that?

Thank you, Silvano

Welcome!

From what I recall, there has been a plan to design a field to accomodate exactly this, but I am not sure if it was ever completed..

However, it is still perfectly possible using the select box link field which is included by default. You will need to setup an extra table, however: recipe-ingredients, with an SBL to both recipes and ingredients. Then, in that section, you can also add other information like quantity, type of ingredient (additional or basis, for instance).

The backend will be a bit cluttered, and it will be hard to manage the content from Symphony itself. But: websites like this often have a frontend where all the data is entered, so you could build the UI yourself and make it shine.

Hope this helps!

Hmm I'm not sure I would call it many-to-many relationship.

If your problem is to add a quantity - It would be a property.

So What I would do is the following.

Section 1. List of all your Ingredients.

Section 2. SubSection Manager - Ingredient + Quanity (hidden)

Section 3. Recipie with a SubSection Manager including Section 2.

I am sure there are other solutions - But if you want the ability to search for all recipies with a particular ingredient this could be one way of doing it. Otherwise you would skip Section 2. but add a 'new' field in section 3 something like dynamic text-group maybe. which would allow you to define the sizes (if you have the same number of entries in the same order you might match up.

That is if you want all your ingredients to be separately listed for filtering etc

Thank you for your comments.

The select box link field, suggested by @creativedutchmen, doesn't allow to create new entry, which is why I excluded it.

In the end I think I will follow a way similar to the one proposed by @gunglien:

  • Section 1 "Ingredients Index" contains all the ingredient names and their carachterists;
  • Section 2 "Ingredients" contains all the ingredients related to a recipe and their quantity (I'm trying to use a Selectbox Link Field Plus for its ability to create an entry using a popup window);
  • Section 3 "Recipes" contains all the recipes and ingredients are managed by a Subsection Manager link the Ingredients section.

Seems to work well 'till now, though the recipe editing page is a but cluttered for the Symphony standard (that means, actually, that it is incredibly better than that the 99% of the CMSes people is used to).

Thank you, Silvano

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details