Chado Prepare: Entity Type Creation -ensure terms attached fully
laceysanderson opened this issue · 2 comments
During PR #244
I don't think the creation of Entity Types is done, but I'm not familiar with the design to know what to do after this. The term is being passed in when creating the entity type but I'm not sure if that's correct.
We need to further validate this as I'm not sure the connection is quite right yet but didn't want to hold up the PR merge looking for this information as it's holding up fields.
This is getting close to being done!
The following is already done in the branch tv4g1-issue256-tripalContentType-termsAttached
✅ Pass term object to create and it saves IDSpace and Accession + sets help text based on term definition if not already set
✅ The content type ID/Name (i.e. bio_data\d+) is not automatically created when the content type is saved
✅ If not set already, the category, hide_empty_field and ajax_field are set with sensible details on save.
✅ Label, help text, term IDSpace + Accession are now checked/required on save (exception thrown).
✅ There is a new setTerm() method to allow you to set the term details with a term object rather then separately.
✅ Upgraded edit/create tripalentitytype form to show the attached term if set.
✅ Updated some tests which didn't meet the new requirements for content types.
What is left to do:
- Update edit/create tripalentitytype form to let you set the term -similar to what stephen did in the TripalField field settings.
- Update edit/create tripalentitytype form to validate requirements added above.
Note: Originally, I was going to autocreate the term if it didn't already exist but I've decided not to add this as there are not enough details to create a good term ;-p (e.g. we are missing the vocabulary and definition).
This is now complete in the branch tv4g1-issue256-tripalContentType-termsAttached
. I will make the PR tomorrow.
Specifically, I have now also finished:
✅ Edit/create form now has the same term autocomplete that field settings do. It is set via form state on create and via the term on update. It's disabled on update.
✅ Added to the validate of the edit/create for. It now validates the following:
- All required values were supplied (validated by Drupal automatically.
- No entity with the same label already exists
- The term was entered in the correct format:
NAME (IDSPACE:ACCESSION)
- No entity exists with the same term
- The term already exists (separate message for missing ID Space vs. Accession)
✅ The term is added to the entity during the submit
✅ The content type listing is updated to display the term
✅ Fixed bug in the entity where it set the ID Space in setTermAccession() instead of the accession
✅ Fixed a bug where you couldn't save an existing content type because it tried to re-assign the id.
There is also a very simple test for creating the content type that was added before.