function tripal_cv_get_cv

2.x tripal_cv.DEPRECATED.inc tripal_cv_get_cv($select_values)
3.x tripal_cv.DEPRECATED.inc tripal_cv_get_cv($select_values)
1.x tripal_cv.api.inc tripal_cv_get_cv($select_values)

Purpose: To retrieve a chado controlled vocabulary object

   $select_values = array(
     'name' => 'feature_property'
   );
   $cv_object = tripal_cv_get_cv($select_values);

The above code selects the feature_property cv and returns the following object:

   $cv_object = stdClass Object (
     [cv_id] => 13
     [name] => feature_property
     [definition] =>
   );

Parameters

$select_values: An array meant to uniquely select a given controlled vocabulary

Return value

Chado controlled vocabulary object

The controlled vocabulary is selected using tripal_core_chado select and as such the $select_values array parameter meant to uniquely identify the controlled vocab to be returned follows the same form as when using tripal_core_chado_select directly.

Example Usage:

Related topics

File

tripal_cv/api/tripal_cv.api.inc, line 53
Controlled Vocabulary API

Code

function tripal_cv_get_cv($select_values) {

  $columns = array(
    'cv_id',
    'name',
    'definition',
  );
  $results = tripal_core_chado_select('cv', $columns, $select_values);
  if (sizeof($results) == 1) {
    return $results[0];
  }
  elseif (empty($results)) {
    watchdog('tripal_cv', 
    'tripal_cv_get_cv: No cv matches criteria values:%values', 
    array('%values' => print_r($select_values, TRUE)), 
    WATCHDOG_WARNING
    );
    return FALSE;
  }
  else {
    watchdog('tripal_cv', 
    'tripal_cv_get_cv: 2+ cvs match criteria values:%values', 
    array('%values' => print_r($select_values, TRUE)), 
    WATCHDOG_WARNING
    );
  }

}