Controller, Chado Generic Autocomplete.
| Drupal\tripal_chado\Controller\ChadoGenericAutocompleteController::handleGenericAutocomplete |
( |
Request |
$request, |
|
|
string |
$base_table, |
|
|
string |
$column_name, |
|
|
string |
$type_column, |
|
|
string |
$property_table, |
|
|
int |
$match_limit = 10, |
|
|
int |
$type_id = 0 |
|
) |
| |
Generic Chado autocomplete method.
NOTE: This is suitable to use for any chado table where the returned value is from a single column.
For simplicity, this autocomplete assumes that the primary key of the base table is the base table name + '_id', and that the type columnn is named 'type_id'.
To support columns without a unique constraint, the returned autocomplete value includes the primary key numeric value in parentheses at the end, e.g. "Impressive Publication (42)".
- Parameters
-
| \Symfony\Component\HttpFoundation\Request | $request | Represents the current HTTP request. |
| string | $base_table | Chado base table name. |
| string | $column_name | Name of chado base column in the specified table to be returned. |
| string | $type_column | If the base table has a type column, the column name. This is usually "type_id". Use a single character placeholder if absent. |
| string | $property_table | Property table name, use same name as base table if not needed. |
| int | $match_limit | Desired number of matching names to suggest. See ::getDefaultOptions() for the default value. If set to zero, then autocomplete is disabled. Define in autocomplete route parameter e.g. ['match_limit' => 15]. |
| int | $type_id | Restricts the results returned to a specific type. This must be a value present in the $type_column and also present in the chado cvterm table. Set to 0 in order to not restrict to a specific type. Define in autocomplete route parameter e.g. ['type_id' => 0]. |
- Returns
- Symfony\Component\HttpFoundation\JsonResponse Matching table results in an array where the value of the $column_name column is both the key and the value. If $type_id is provided, the type name is added to the end of the key/value surrounded by square brackets. If the include_pkey property is TRUE then the primary key value is appended to the end of both the key and value surrounded by curved brackets, e.g. 'ftbA-1 [gene] (42)'.