Passer la navigation

[Résolu] Change CPT relationship from 1 to many to many-to-many

Ce fil est résolu. Voici une description du problème et la solution proposée.

Problem:

The customer wanted to change an existing Toolset relationship from one-to-many to many-to-many so one event could be connected to multiple partners, and wanted to know whether this could break existing relations.

Solution:

The change is possible, but it should be done carefully on a staging site. Existing event-partner connections need to be checked after the change, and any Views, Forms, templates, or custom code depending on the old one-to-many structure may need updates. It was also noted that many-to-many setups may require an intermediary post type when relationship fields are needed.

This support ticket is created Il y a 2 weeks, 2 days. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Ce sujet contient 1 reply, a 1 voix.

Dernière mise à jour par Christopher Amirian Il y a 2 weeks, 1 day.

Assisté par: Christopher Amirian.

Auteur
Publications
#2862155

I have a client setup with a couple CPT setup and some relationships. The main feature is a list of events created in collaboration with several partners. In origin Each event could only have a single partner but now they would like to change this and have multiple partners collaborate to a single event. The relationship is therefore changing from 1-to-many to many-to-many.

Is it possible or do I run the risk of breaking current relations?

#2862201

Christopher Amirian
Supporter

Les langues: Anglais (English )

Hi,

Welcome to Toolset support:

I would not recommend changing this as you will need to check many possible problems:

- existing Event → Partner connections should be checked after the change
- any Views, Forms, templates, or custom code that depend on the old one-to-many structure may need updating
- many-to-many relationships may use an intermediary post type if you need relationship fields

So I would say it is possible but you need to do it with caution on a staging/copy version of the website and see if it works on your use case.

Thanks.