|
Tripal
|


Public Member Functions | |
| __construct (array $configuration, $plugin_id, $plugin_definition, ChadoConnection $connection) | |
| label () | |
| description () | |
Static Public Member Functions | |
| static | create (ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) |
Public Attributes | |
| ChadoConnection | $connection |
Protected Member Functions | |
| getTableColumns (array $chado_tables, string $filter='all') | |
| getTableCache () | |
| addTableToCache (string $chado_table, array &$cached_tables) | |
| makeUpsertConditions (array $values, array $key_columns) | |
| makeAlias (string $name) | |
| unmakeAlias (string $name) | |
| removeTablePrefix (array $values) | |
| addConditions (object &$query, array $conditions, array $options) | |
| validateInput (array $user_values, array $valid_values) | |
| dereferenceBuddyRecord (array $values) | |
| subsetInput (array $user_values, array $valid_tables) | |
| validateOutput ($output_records, array $values) | |
Base class for chado_buddy plugins.
| Drupal\tripal_chado\ChadoBuddy\ChadoBuddyPluginBase::__construct | ( | array | $configuration, |
| $plugin_id, | |||
| $plugin_definition, | |||
| ChadoConnection | $connection | ||
| ) |
{}
|
protected |
Adds the conditions to the database query. Implements case insensitive queries if requested.
| object | $query | Associative array where keys are table name+dot+table column. |
| array | $conditions | Associative array of conditions to add to the query. |
| object | $options | Associative array of options as passed to the calling buddy function. The option 'case_insensitive' can contain a single key string, or an array of multiple keys for which a case insensitive query is desired. |
|
protected |
Add a chado table to the cache, used only by getTableColumns()
| string | $chado_table | Name of the table to add |
| array | $cached_tables | Schema information will be inserted in this array for the table indicated above. The array follows this format:
|
|
static |
Implements ContainerFactoryPluginInterface->create().
Since we have implemented the ContainerFactoryPluginInterface this static function will be called behind the scenes when a Plugin Manager uses createInstance(). Specifically this method is used to determine the parameters to pass to the constructor.
| \Symfony\Component\DependencyInjection\ContainerInterface | $container | |
| array | $configuration | |
| string | $plugin_id | |
| mixed | $plugin_definition |
Reimplemented in Drupal\tripal_chado\Plugin\ChadoBuddy\ChadoCvtermBuddy, and Drupal\tripal_chado\Plugin\ChadoBuddy\ChadoPropertyBuddy.
|
protected |
Used to dereference a ChadoBuddyRecord in the $values array into its component values.
| array | $values | An associative array to be validated. Keys are table+dot+column name, values are the database table values. The special case value of 'buddy_record' => ChadoBuddyRecord will have its component values appended to the values. In the case of a duplicated key, if the value in the ChadoBuddyRecord is different from the one in the array, then an exception is thrown. |
| Drupal |
tripal_chado\ChadoBuddy\Exceptions\ChadoBuddyException If the key 'buddy_record' does not have a ChadoBuddyRecord as its value. If a value inside the ChadoBuddyRecord is different than one in the $values array.
| Drupal\tripal_chado\ChadoBuddy\ChadoBuddyPluginBase::description | ( | ) |
{}
|
protected |
Retrieves the chado table definition cache used by getTableColumns().
|
protected |
Retrieve a list of table columns for one or more chado tables. Schema information is cached for better performance.
| array | $chado_tables | One or more chado table names. |
| string | $filter | 'required' = return columns that [1]: have a NOT NULL constraint, and [2]: do not have a default value and are not serial, such as a primary key. In other words, a column with a NOT NULL constraint but with some form of a default value is considered to be not required. 'unique' = return only columns that are part of any unique constraint. 'all' (default) or anything else = return all columns. |
| Drupal |
tripal_chado\ChadoBuddy\Exceptions\ChadoBuddyException For invalid table name.
| Drupal\tripal_chado\ChadoBuddy\ChadoBuddyPluginBase::label | ( | ) |
{Returns the translated plugin label.}
Implements Drupal\tripal_chado\ChadoBuddy\Interfaces\ChadoBuddyInterface.
|
protected |
Replace the first period with a double underscore This makes the string valid as a table column alias.
| string | $name | table name+dot+table column |
|
protected |
Used by upsert functions to generate a subset of values using only key columns, e.g. 'name' for cv table. The key columns are those which are present in any of the unique constraints that the table may have.
| array | $values | An associative array where the key is the table.column_name. |
| array | $key_columns | Only column keys in this list should be returned. |
|
protected |
Removes the table prefix from $values keys so that they can be used directly in an INSERT. The prefix is anything up to and including the first period.
| array | $values | Associative array where keys are table name+dot+table column. |
|
protected |
Used to return a subset of values applicable to a single chado table, e.g. remove db table columns when inserting a new dbxref.
| array | $user_values | An associative array to be filtered. Keys are table+dot+column name, values are for that table+column. |
| array | $valid_tables | An array listing which tables should have keys returned. |
| Drupal |
tripal_chado\ChadoBuddy\Exceptions\ChadoBuddyException If after subsetting there is nothing left.
|
protected |
Replace the first double underscore with a period. This reverts the change made by the makeAlias() function.
| string | $name | table name+__+table column |
|
protected |
Used to validate input arrays to various buddy functions.
| array | $user_values | An associative array to be validated. Keys are table+dot+column name, values are the database table values. |
| array | $valid_values | An array listing all valid keys for $user_values. |
| Drupal |
tripal_chado\ChadoBuddy\Exceptions\ChadoBuddyException If $user_values array is empty. If a key in $user_values is not in $valid_values.
|
protected |
Used to validate results from a buddy function, to ensure there is exactly one record present.
| mixed | $output_records | An array of zero or more ChadoBuddyRecords. To be valid, it must contain exactly one ChadoBuddyRecord. |
| array | $values | Pass query values to print if an exception is thrown. |
| Drupal |
tripal_chado\ChadoBuddy\Exceptions\ChadoBuddyException If not exactly one record is present.