Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add pseudoconstant for Relationship.relationship_type_id #19278

Merged

Conversation

colemanw
Copy link
Member

Overview

Updates the relationship schema to add a pseudoconstant to the relationship_type_id field.

Before

No pseudoconstant declared, but APIv3 would return an option list for the field (but in a nonstandard format).

After

Pseudoconstant declared. APIv3 and APIv4 return option list in standard format, unless legacy "is_form" param is set.

Technical Details

This adds basic pseudoconstant support for the field using name_a_b and label_a_b (it does not support other properties like name_b_a)

For legacy purposes it preserves the work done in #11853 to return a list like [1_a_b => Child of, 1_b_a => Parent of] if the "is_form" flag is set.
This was very nonstandard but is used to support in-place editing of the relationship type list on the relationship form.

@civibot
Copy link

civibot bot commented Dec 26, 2020

(Standard links)

@civibot civibot bot added the master label Dec 26, 2020
@seamuslee001
Copy link
Contributor

@colemanw test fails relate

@colemanw colemanw force-pushed the relationshipTypePseudoconstants branch from 1015b78 to 355aa7c Compare December 28, 2020 16:01
This adds basic pseudoconstant support for the field using name_a_b and label_a_b
(it does not support other properties like name_b_a)

For legacy purposes it preserves the work done in civicrm#11853
to return a list like [1_a_b => Child of, 1_b_a => Parent of] if the "is_form" flag is set.
This was very nonstandard but is used to support in-place editing of the relationship type list
on the relationship form.
@colemanw colemanw force-pushed the relationshipTypePseudoconstants branch from 355aa7c to 1ac9bb5 Compare December 28, 2020 16:08
@eileenmcnaughton
Copy link
Contributor

Test Result (6 failures / -25)
api_v3_RelationshipTest.testRelationshipCreateWithIncorrectData with data set "APIv4"
api_v3_RelationshipTest.testGetTypeOperators with data set "APIv4"
api_v3_RelationshipTest.testGetRelationshipByTypeDAO with data set "APIv3"
api_v3_RelationshipTest.testGetRelationshipByTypeArrayDAO with data set "APIv4"
api_v3_RelationshipTest.testGetRelationshipByTypeReciprocal
api.v4.Entity.ConformanceTest.testConformance with data set "Relationship"

@colemanw colemanw force-pushed the relationshipTypePseudoconstants branch from baf8f46 to 78fae00 Compare January 4, 2021 14:09
@eileenmcnaughton
Copy link
Contributor

We discussed this & code approach seems OK - I'm going to give it a r-run

@eileenmcnaughton
Copy link
Contributor

OK - this seems to work the same - @colemanw explained that for apiv3 it will be possible to pass the name_a value for the relationship - whereas the v4 api uses either name_a or name_b

@eileenmcnaughton eileenmcnaughton merged commit 61c99fc into civicrm:master Jan 13, 2021
@eileenmcnaughton eileenmcnaughton deleted the relationshipTypePseudoconstants branch January 13, 2021 23:36
@colemanw
Copy link
Member Author

colemanw commented Jan 14, 2021

@eileenmcnaughton corection - both api versions will only use name_a_b and label_a_b not the inverse. But only api3 still accepts the oddball is_form for the sake of #11853

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants