Stillat / relationships

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

Taxonomy tag prints two sets of terms #13

Closed bland-industries closed 1 year ago

bland-industries commented 1 year ago

I have a collection that has a related taxonomy. I was using this add-on to make the bi-directional connection between the two. Mostly so I can sort the collection entries in the taxonomy. I was then printing out the taxonomy terms with the taxonomy tag and it printed out the normal terms with the {{title}} being the normal title case name of the term. and then it prints additional terms only when this add-on is installed. I can tell because the {{title}} is all snake cased of the taxonomy name and term. Example: if the taxonomy is "Building Type" and the term is "Gas Station", then the output would be building_typegas_station. Is there a work around you are aware of? I really want to use this add on so any help would be appreciated. Thanks.

JohnathonKoster commented 1 year ago

Hi there!

Would you be able to create a simple sample repository that recreates this issue?

bland-industries commented 1 year ago

https://github.com/Bwata/Statamic-Relationships-Add-on-Example

JohnathonKoster commented 1 year ago

Thanks for the example. I've taken a look, and found the term you wish to remove is listed as an actual term, which would make it appear in the tag output:

image

The following relationship also does not match the handles inside the buildings blueprint:

<?php

Relate::manyToMany(
    'term:building_types.buildings',
    'buildings.building_type'
);
image

After removing the incorrect term, updating the relationship to match the handles:

<?php

Relate::manyToMany(
    'term:building_types.buildings',
    'buildings.building_types'
);

And then running:

php please relate:fill

I have been unable to reproduce this afterwards

bland-industries commented 1 year ago

Thank you very much. My only guess as to how those were added would be because of the typo?

JohnathonKoster commented 1 year ago

That I'm not sure on - I wasn't able to reproduce creating that term even with the typo.