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

dev/core#715 - Fix delete action on RelationshipType form #13581

Merged
merged 1 commit into from
Feb 13, 2019

Conversation

colemanw
Copy link
Member

@colemanw colemanw commented Feb 12, 2019

Overview

See https://lab.civicrm.org/dev/core/issues/715

Before

Fatal error when deleting a relationship type

After

Form works

Technical Details

This fixes the bug for now but I'm not sure this is really the right fix long-term.

When I dig into the code of CRM_Core_Form_EntityFormTrait I see that every form has to declare a rather cumbersome array in setEntityFields which appears to duplicate metadata that could be retrieved from the api... and then another function setEntityFieldsMetadata which appears to supply that same information that was hard-coded in the previous function.
Couldn't all this be avoided by calling getfields on the entity and passing in the action? Then we'd avoid trying to retrieve inappropriate fields for that action (which was the cause of this bug) and we'd also avoid all the hard-coded (and hard-to-maintain) getfields boilerplate in the setEntityFields fn.

@civibot
Copy link

civibot bot commented Feb 12, 2019

(Standard links)

@civibot civibot bot added the master label Feb 12, 2019
@colemanw
Copy link
Member Author

@eileenmcnaughton what is the reason for all those hard-coded arrays in setEntityFields functions?

@mattwire
Copy link
Contributor

@colemanw I think the intention was that it would provide a stepping stone, as many of the entities do not have very good metadata (ie. suitable for adding to forms) stored on the XML/DAO. Also not all fields can be added automatically (due to conditionals/logic on the form etc). It would seem to be a good logical next step to optionally build entityFields directly using the getfield API.

@eileenmcnaughton
Copy link
Contributor

This seems OK as an approach - my personal belief is that delete forms should not actually be part of the same form as create/edit - for performance reasons & code complexity reasons

@eileenmcnaughton
Copy link
Contributor

@colemanw can you switch this to the rc- I think this was a recent regression

@colemanw colemanw changed the base branch from master to 5.11 February 13, 2019 00:06
@civibot civibot bot added 5.11 and removed master labels Feb 13, 2019
@colemanw
Copy link
Member Author

@eileenmcnaughton done

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