Closed carolyncaron closed 3 months ago
For a method that will return some relevant values relating to the combination of Trait Name + Method Short Name + Unit Name.
Return value options:
An array where each trait asset gets resolved into its cvterm record plus the genus information. trait - name, description, ... method - name, description, ... unit - name, description, ... genus
A Boolean value. True if combination already exists and a False value to indicate that the combination does not exists in the genus (May be in the other genus).
Uses (where trait name, method name and unit name are available):
/**
* Get trait, method and unit records.
*
* @param $trait
* @param $method
* @param $unit
*/
public function getTraitMethodUnitCombination($trait, $method, $unit) {
// Get Trait
// Get Method
// Get Unit
return []
}
I would like to include this method in the same branch and PR since it relates to the issue above.
@laceysanderson and @carolyncaron please do expand on this method design.
Branch
g4.78-fixTraitServiceGetters
Groups
Group 4 - API | Services | Plugins
Describe
The get functions in TripalCultivatePhenotypesTraitsService.php are not accommodating situations when we have multiple methods relating to a trait, or multiple units for a method. For example, the following Trait + Method + Unit combinations are all valid in the database at the same time:
Thus, we need a way to get all method records for a single trait, and all units for a single method.
Design
In general, situations in which more than one record is returned should be handled (including when it shouldn't be possible, which warrants an exception being thrown) rather than
LIMIT
being used in an SQL query. These are the lines in question:https://github.com/TripalCultivate/TripalCultivate-Phenotypes/blob/526caaf5f97054c69b99449db564f40f90b89a8c/trpcultivate_phenotypes/src/Service/TripalCultivatePhenotypesTraitsService.php#L337
https://github.com/TripalCultivate/TripalCultivate-Phenotypes/blob/526caaf5f97054c69b99449db564f40f90b89a8c/trpcultivate_phenotypes/src/Service/TripalCultivatePhenotypesTraitsService.php#L388
https://github.com/TripalCultivate/TripalCultivate-Phenotypes/blob/526caaf5f97054c69b99449db564f40f90b89a8c/trpcultivate_phenotypes/src/Service/TripalCultivatePhenotypesTraitsService.php#L411