I'm working on a site that has a workflow in which you might approach the system with one thing (say: an article) or another (say: a person). Articles can have relationships with people, and vice versa.

Normally I would say "make one content type the parent and be done with it," but the required workflow demands that users be able to create the relationship from either direction — a user may want to add a person to the system and relate that person with an existing article, and I don't want them to have to edit every relevant article to create that relationship.

So, you might say, ok: allow either to be the parent — have two relationship fields, and whenever you have to display those relationships, use PHP to filter out any duplicates that might exist.

BUT: what happens when I want to destroy that relationship — not the entries, just the relationship(s)?

I now have to track down every article/person manually, and remove those relationships from each.

It feels like I'm over-thinking this, but I thought I'd ask: Is there a way to create "peer" relationships, one that can be created only once from either peer?

Would this be better handled by something else, like say Categories?

(Now that I'm thinking about it, no categories won't work, because I'd have to go back and add that category to every relevant sibling entry.)

Playa from Pixel & Tonic has sibling relationships that might work the way you want them to.

  • 2
    The problem with Sibling relationships is it requires you linking to a parent entry which can be harder to manage down the road. Especially if you are only creating entries for the purpose of being the parent in a relationship – Justin Long Dec 4 '12 at 0:08
  • Yeah, but that parent could be a throw away that doesn't really matter in this case. There really is no clean way to do this and one channel used for only grouping the sibling relationships is a reasonable approach to solve this problem. – Stuart McCoy Dec 4 '12 at 1:03
  • If you decided to make one the parent, you could use Introvert to display that relationship on the child's entry page. devot-ee.com/add-ons/introvert This doesn't solve your entry workflow, but it does help make relationships obvious in the CP if you went with a simpler solution. – Jim Butts Feb 19 '13 at 3:18

This is not going to be very helpful to you since they have not released it publicly yet but Visitor Plus does exactly what you are looking when it is released. I have done something similar in the past with Tagger but it has the same shortfalls as categories for the most part.

The relationship that you are describing is called a "many to many" relationship model. As you have found, the ExpressionEngine control panel doesn't always handle your needs very well. That's to be expected because every project is different.

What you might need to do is construct a custom entry management interface with Safecracker. This won't replace your control panel, but rather provide a more targeted interface for your users. Playa and Matrix are compatible with Safecracker.

Of course, this is more work, but hopefully it saves work down the road.

Your Answer

 
discard

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.