public function TripalField::query

3.x TripalField.inc public TripalField::query($query, $condition)

Used to filter records that match a given condition.

Records that belong to a content type can be filtered using the fields. This function should be implemented if the field supports filtering as specified in the elementInfo() function. With this function, the query object appropriate for the storage back-end is passed into the function.

The condition array passesd in will have three values:

  • column: the key indicating how the filter should occur.
  • op: the operation to perform (e.g. equals, contains, starts with etc.
  • value: the value for filtering.

The column used for filtering will be a comma-speperated list of controlled vocabulary IDs. This comma-separate list corresponds directly to the heirarchy of elements provided by the elementInfo() function. For example, if a field provides organism information then it may use the OBI:0100026 term for the field, and the term TAXRANK:0000005 for the term to indicate the 'Genus'. If these fields are properly organized in the elementInfo() function then the "column" of the condition when a user wants to search by genus will be: OBI:0100026,TAXRANK:0000005.

Parameters

$query: A query object appropriate for the data storage backend. For example, The Tripal Chado module will provide a SelectQuery object.

$condition: The field specific condition as set in the TripalFieldQuery object.

1 method overrides TripalField::query()
ChadoField::query in tripal_chado/includes/TripalFields/ChadoField.inc
In addition to the rules to follow for the TripalField::query function these should also be followed for the ChadoField::query implementation.

File

tripal/includes/TripalFields/TripalField.inc, line 731

Class

TripalField

Code

public function query($query, $condition) {

}