Relationship type: asymmetrical

Created on 24 May 2025, 14 days ago

Problem/Motivation

Some relationships are symmetrical, siblings, partners, and spouses. The labels are contact type are the same, and should not be different

Steps to reproduce

Proposed resolution

Add a property to cm_relationship_type, asymmetrical.

When asymmetrical, the label and contact type may be different.

Remaining tasks

When relationships are expanded to grant permissions to other contacts, the permissions granted are the same when symmetrical.

User interface changes

Relationship type form

When asymmetrical is unchecked, only one label and bundle element is shown. When checked, both contacts have a label and a bundle field.

API changes

Data model changes

crm_relationship_type:

asymmetrical: boolean

πŸ“Œ Task
Status

Active

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States bluegeek9

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @bluegeek9
  • πŸ‡ΊπŸ‡ΈUnited States jdleonard Austin, TX, USA

    I'm totally here to make things difficult...

    Let's say I want to create a view that shows a Contact's siblings. This is straightforward if the Contact has a Relationship from that Contact to each sibling Contact. It is much less straightforward if the siblings might be referenced on Relationships from the Contact and/or on Relationships to the Contact.

    Queries would be much simpler if all Relationships were one-way.

    Would it make sense for a symmetrical relationships to be represented as two one-way relationships (possibly referencing each other)?

    I realize I'm posting this on an issue about asymmetrical relationships...

  • πŸ‡ΊπŸ‡ΈUnited States bluegeek9

    This issue concerns relationship types. This simplifies the relationship type form but doesn't change the schema of relationship entities.

    I don't think making relationships one way will simplify things. There would be significant duplicate data. Additionally, the labels, relationship type, and contact are not on the relationship entity. The labels are on the relationship type and contact entity.

    There is a service to return the relationships for a contact. There will need to be custom view fields, filter plugins.

    Civi simplifies the query using a cache table with two entries for each relationship. Drupal offers caching mechanisms. If necessary, we could create a table with three columns that the relationship service can use.

    tldr;
    Premature optimization is the root of all bugs.

  • Pipeline finished with Skipped
    13 days ago
    #506118
  • πŸ‡ΊπŸ‡ΈUnited States bluegeek9
Production build 0.71.5 2024