Skip Navigation

[Resolved] one-to-one relationship doesn’t work

This thread is resolved. Here is a description of the problem and solution.

Problem:

I have Posttype1 and Posttype2 with one-to-one relationships.

And I have issue:

- no Posttype2 shown in window of "Connect existed Posttype2" modal box, just "no results found"

- I have some error in dahsboard in relationship post:

https://toolset.com/forums/topic/one-to-one-relationship-doesnt-work/#post-1121969

Solution:

This should be a problem of the "SG Optimizer" plugin, you can switch off memcached option.

Relevant Documentation:

This support ticket is created 6 years, 3 months ago. 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.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9: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/Hong_Kong (GMT+08:00)

This topic contains 7 replies, has 2 voices.

Last updated by kirillS-3 6 years, 3 months ago.

Assisted by: Luo Yang.

Author
Posts
#1121969
Screenshot 2018-10-06 16.04.51.png
Screenshot 2018-10-06 16.04.36.png

I have Posttype1 and Posttype2 with one-to-one relationships.

And I have issue:
- no Posttype2 shown in window of "Connect existed Posttype2" modal box, just "no results found"

- I have some error in dahsboard in relationship post:

Warning: count(): Parameter must be an array or an object that implements Countable in /munchenguide.com/wp-content/plugins/types-access/vendor/toolset/toolset-common/inc/m2m/association/query/association_query_v2.php on line 322

Warning: Invalid argument supplied for foreach() in /munchenguide.com/wp-content/plugins/types/application/viewmodels/related_content_post.php on line 117

Warning: count(): Parameter must be an array or an object that implements Countable in munchenguide.com/wp-content/plugins/types-access/vendor/toolset/toolset-common/inc/m2m/association/query/association_query_v2.php on line 322

Both mistakes disappear in parent post type, if I make it one-to-many, but still "no results found" if I try to connect posts by editing child post.

And everything is ok if I make it many-to-many...
Really strange.

#1122574

Hello,

The problem you mentioned above is abnormal, please try these:

1) In case it is a compatibility problem, please deactivate other plugins, and switch to wordpress default theme 2017, and test again

2) If the problem still persists, please provide database dump file(ZIP file) of your website, also point out the problem page URL, I need to test and debug it in my localhost, thanks
https://toolset.com/faq/provide-supporters-copy-site/

#1124293
city.JPG

Thanks for the details, I have tried your database dump file, it works fine in my localhost, see screenshot city.JPG.

So it might be a server problem, please check these:
1) Check if your webserver meets the requirement of Toolset plugins
https://toolset.com/toolset-requirements/
2) If the problem still persists, please provide a live test site with the same problem, we need a live website to test and debug.

#1125107

Thanks for the details, I have already tried the opposite connect City posts from single CitiesSights and CitiesEvents post in my localhost, there isn't the similar problem.

And I can see the problem in your website, it seems to be a server problem related to your PHP version, see similar thread:
https://toolset.com/forums/topic/error-warning-on-cred-form-with-post-reference-field/

can you try with other PHP version? for example the latest version of PHP 7.2.10:
hidden link

#1125288

Actually I use PHP 7.2.10: hidden link

I will try different version

#1125432

I tried with 7.0.32 and 7.1.22 - same results and back to 7.2.10.

By the way, I have similar issue with other site (https://toolset.com/forums/topic/some-error-with-relationships/ ) , probably it's connected to the same problem.

Anyway, for me is just looks strange that everything works well before (as minimum 1 month ago there is no error like this).
And actually I don't want to change hosting - Siteground is nice and I think very popular also among your customers...
What could we do to solve this issue?

#1125892
city2.JPG

This should be a problem of the "SG Optimizer" plugin, I have done below modification in your website:
1) Deactivate the "SG Optimizer" plugin,
2) Use FTP tool login your website, in "wp-content" folder, rename the file "object-cache.php" to "object-cache.php-bak"

Then test again here:
hidden link

See screenshot city2.JPG

It works fine.

I suggest you check it with author of "SG Optimizer" plugin, there should be an option to disable the object-cache.php

#1126228

My issue is resolved now. Thank you!
Actually I don't disable entire SG Optimiser, but just switched off memcached option. It is something then this plugin (deeply integrated with hosting cache) use option to store database requests in server memory. It is not harm my site speed for now, but could be important in future.
Anyway, thanks a lot for your help - it was difficult to find the problem on my side.