Skip Navigation

[Resolved] Error while adding relationship of types

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.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 19 replies, has 2 voices.

Last updated by nedG 1 year, 6 months ago.

Assisted by: Minesh.

Author
Posts
#2477761

I had previously had some relationships between...

INSTALLERS >> ADDRESSES
DISTRIBUTORS >> ADDRESSES

I had created the relationships prior to 2018 and it seems after some investigating that they must have become corrupted. I don't see a "migrate relationships" option.

I simply tried recreating the relationships and assigning the post types... but I get an error... "There has been an error, please try again later."

The issues seem exactly like the one reported here...
https://toolset.com/forums/topic/error-while-adding-relationship-of-types-created-in-or-before-2018/

I have tried that solution and nothing is working.

Please help

#2478127

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

I see there are multiple post relationship created. If you have created the following post relationship:
INSTALLERS >> ADDRESSES
DISTRIBUTORS >> ADDRESSES

Then it will be many to many post relationship between post type INSTALLERS and DISTRIBUTORS and the ADDRESSES will seat as intermediary post type.

I see you created many to many post relationship between post type: INSTALLERS and ADDRESSES
hidden link

Do you have old backup of your site?

I had created the relationships prior to 2018 and it seems after some investigating that they must have become corrupted. I don't see a "migrate relationships" option.
==>
Are you sure you have created those relationship before Toolset Types version 3.0?

#2478227

Yes, these relationships were originally created prior to 2018.

Here is the error I received when trying to recreate the relationships and connecting the post types...

=======================
Error Details
=============
An error of type E_ERROR was caused in line 28 of the file /var/www/vhosts/crawlspacedoors.com/crawlspacedoors.com/wp-content/plugins/types/vendor/toolset/toolset-common/inc/m2m/DatabaseLayer/Version2/AssociationQuery/Condition/AssociationId.php. Error message: Uncaught InvalidArgumentException: Invalid association ID. in /var/www/vhosts/crawlspacedoors.com/crawlspacedoors.com/wp-content/plugins/types/vendor/toolset/toolset-common/inc/m2m/DatabaseLayer/Version2/AssociationQuery/Condition/AssociationId.php:28
Stack trace:
#0 /var/www/vhosts/crawlspacedoors.com/crawlspacedoors.com/wp-content/plugins/types/vendor/toolset/toolset-common/inc/m2m/DatabaseLayer/Version2/AssociationQuery/ConditionFactory.php(142): OTGS\Toolset\Common\Relationships\DatabaseLayer\Version2\AssociationQuery\Condition\AssociationId->__construct()
#1 /var/www/vhosts/crawlspacedoors.com/crawlspacedoors.com/wp-content/plugins/types/vendor/toolset/toolset-common/inc/m2m/DatabaseLayer/Version2/AssociationQuery/Query.php(703): OTGS\Toolset\Common\Relationships\DatabaseLayer\Version2\AssociationQuery\ConditionFactory->association_id()
#2 /var/www/vhosts/crawlspacedoors.com/crawlspacedoors.com/wp-content/plugins/types/vendor/toolset/toolset-common/inc/m2m/deprecated/ToolsetAssociationQueryV2.php(287): O

============================

I can recreate the relationships... but when I try to assign the post types... I get an error... "There has been an error, please try again later."

#2478241

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Do you have old backup, I mean before migration to new relationship? If yes, can you please send it to me.

Also, can you please send me duplicator copy of your current site as well. I will have to setup your site on my local machine to dig this further.

More info:
- https://toolset.com/faq/provide-supporters-copy-site/

I have set the next reply to private which means only you and I have access to it.

#2478627

I have already provided all of the access credentials in the original support request. You can add the duplicator package and do what you need to troubleshoot.

I don't have a backup of the DB prior to 2018. I will have to recreate everything

#2479059

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Can you please confirm what steps you chose as if you have migrated the site to new relationship it will display the relationship is migrated but on the post relationship listing page I see one relationship but it seems its created recently?

Can you please tell me when you find that the post relationship is having issues and what steps you followed?

Did you try to delete existing post relationship?

As least I will require some background of how and when the relationship is broken that will help me to debug this issue further. Also, please confirm that you have many-to-many post relationship between post types INSTALLERS and DISTRIBUTORS and ADDRESSES will be the intermediary post type - right?

#2479067

Yes, the INSTALLER - ADDRESSES relationship is new.
I just recreated it recently.

Now that it is created, please go and edit any INSTALLER CPT. For example, go here...
hidden link

You will see an error down in the "Installers Addresses Relationships" box.

If you choose another INSTALLER and try to edit it and try to assign it to an ADDRESS, you will also get an error.

I have tried deleting the existing post relationship and recreating it. I can do that... but the error persists.

#2479083

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Yes, the INSTALLER - ADDRESSES relationship is new.
I just recreated it recently.
==>
ok.

But as you shared before that you have following relationships:
INSTALLERS >> ADDRESSES
DISTRIBUTORS >> ADDRESSES

Where are those legacy/old relationships? Did you deleted those?

#2479113

I deleted the old relationships. I don't have any backups of them.

I can reassign the posts after the relationships have been recreated.

#2479951

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

I tried duplicator package on your install but its not working. I'm trying to download the copy of your site now using the "ALL in One WP Migration" plugin.

I would like to know, have you connected posts before using the old relationship, I mean did you have establish connections?

#2479985

Yes everything was working previously. I had properly working relationships and CPTs were assigned successfully in those relationships.

I don't know when it stopped working or got corrupted. My client just noticed it recently... but it cold have been broken for quite a while.

#2480713

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Can you please confirm that you have take full backup of your database?

Once you give me green signal and confirm that you took full backup of your database I will try to delete the existing post relationship tables so that it will allow you to create new post relationships.

#2480715

Yes, I have a full backup. Go ahead.

#2480735

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Just to double check with you and ensure that I do not find any connections in the database with the current site that means you will have to connect all elements (connections) - I hope you understand this situation.

#2480761

Yes, I understand all of that. I will connect the CPTs. The problem is that I am unable to do that without getting an error when I connect the CPTs.

Please try it yourself and you will see what I mean.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.