Closed spficklin closed 1 year ago
Why did the validation in ChadoStorage get removed in the last commits? We had talked about removing automated testing but these are further then that and were working before -weren't they? They definitely were in the property field. I wonder if this is a merge conflict mistake @spficklin?
Code Climate has analyzed commit b9443481 and detected 0 issues on this pull request.
The test coverage on the diff in this pull request is 59.9% (50% is the threshold).
This pull request will bring the total coverage in the repository to 34.3% (0.3% change).
View more on Code Climate.
Issues Addressed
Issue #298 Issue #129
Description
This PR adds a new field for managing additional types. There are three types of types that this field supports. This is a required addition prior to Alpha 1 release. The field specifically supports managing "types" in three different ways:
organism.type_id
,pub.type_id
,contact.type_id
, 'featuremap.unittype_id`, etc.type_id
field, but it will always be the same as the entity type. The user should never change it. Examples include all of the feature types (e.g. gene, mRNA) and stock types.analysisprop
table. Example content types include 'Genome assembly', 'Genome annotation' etc.Changes
The following changes were made to support this field:
Drupal\tripal\TripalField\Interfaces\TripalFieldItemInterface::tripalValuesTemplate()
function did not have easy access to the field definitions. So, I added an argument to pass it in. I thought I needed it for this field so I added it but it turned out I didn't. However, I left it as is in th eevent that in the future someone will need the field definition to set anything in the value (e.g. the property key). I updated thetripalValuesTemplate
function for all fields to match.record_id
property whenever a field was saved. This way we don't duplicate the data that is stored in Chado also inside of the Drupal schema. However, when working with properties that have values in linker tables, we also need to store the linker record ID too. This happens in the 3rd case above, where the type for the field is stored in the analysisprop table. I changed theDrupal\tripal\Entity\TripalEntity::preSave
so that it would cache any field whosestorage_plugin_settings
had acache
value set to TRUE. I also changed theDrupal\tripal\TripalField\TripalFieldItemBase::defaultTripalTypes()
function to set therecord_id
property to have acache
value of TRUE. Now, any field that hascache
set to TRUE will get cached by Drupal.fixed_value
then the widget is supposed to honor that and not let the user change the value. This is what allows the content types tied to thetype_id
fields of Chado tables to stay fixed with the content type's type.tripal_chado/config/install/tripal_chado.chado_term_mapping.core_mapping.yml
file was missing mappings for the analysisprop table. I added those.link
action. Previously we hadstore
,join
,replace
andfunction
. Thelink
action is what tells the ChadoStorage class that the field is managing a linked record (e.g. analysisprop). You can see where this gets used in theschema__additional_type
field on line 83. For this field, the property is managing the the primary key (e.g. analysisprop_id), but is linked to the analysis table via theanalysis_id
field.Testing
analysisprop
table.analysisprop
table.This to Note