示例#1
0
 /**
  * Returns the first meta value from a given set of names. Useful when you have a mix of items that could provide a particular detail.
  * @param array $names List of meta names.
  * @return WSAL_DB_Meta The first meta item that exists.
  */
 public function GetFirstNamedMeta($names)
 {
     $meta = new WSAL_DB_Meta();
     $query = '(' . str_repeat('name = %s OR ', count($names)) . '0)';
     $query = 'occurrence_id = %d AND ' . $query . ' ORDER BY name DESC LIMIT 1';
     array_unshift($names, $this->id);
     // prepend args with occurrence id
     $meta->Load($query, $names);
     return $meta->IsLoaded() ? $meta : null;
 }