Stillat / relationships

Provides automated bi-directional @statamic entry relationships
MIT License
16 stars 1 forks source link

2.1.5 relate:fill command removes all relationships (I only have oneToMany) #37

Closed isaackearl closed 2 months ago

isaackearl commented 3 months ago

Hello,

We have a fairly simple setup in our project. Everything works great on version 2.1.4, after upgrading to the latest version, whenever we run the relate:fill command, it simply removes all the relationships. The only thing we are doing is vanilla oneToMany relationships. For now I've downgraded to 2.1.4 as that version continues to work great. On 2.1.5 there is no other indication of issue. The relate:list command runs and lists all the commands correctly.

image image

On 2.1.5 when I run the command it appears to work great in the terminal, but the result is all the relationships are gone

image
JohnathonKoster commented 3 months ago

Would you be able to setup an example repository that exhibits this behavior? That would help to track this down

isaackearl commented 3 months ago

Would you be able to setup an example repository that exhibits this behavior? That would help to track this down

I went ahead and made a VERY simple repository that exhibits the same behavior. The relationship gets cleared from 1 side.

INSTRUCTIONS:

  1. checkout: https://github.com/vicam-consulting/relations-test
  2. composer install
  3. go and look at the control panel and test the relationship between categories and products, you'll see that everything is working great (when you attach one, it will be attached on the other side etc)
  4. now run php please relate:fill, and take a look at git and notice that all of the products have been removed from the category. In other words the "automatic inverse" relationship is all cleared out.
JohnathonKoster commented 3 months ago

Thank you very much for this! I'll take a look this week and let you know what I find out

JohnathonKoster commented 2 months ago

A fix for this is available in 2.1.6