Tripal
|
Public Member Functions | |
__construct (array $configuration, $plugin_id, $plugin_definition, TripalLogger $logger, ChadoConnection $connection, ChadoFieldDebugger $field_debugger) | |
![]() | |
__construct (array $configuration, $plugin_id, $plugin_definition, TripalLogger $logger) | |
getFieldDefinition (string $field_name) | |
addTypes (string $field_name, array $types) | |
getTypes () | |
getPropertyType (string $field_name, string $key) | |
removeTypes (string $field_name, array $types) | |
publishFormValidate ($form, FormStateInterface &$form_state) | |
publishFromSubmit ($form, FormStateInterface &$form_state) | |
![]() | |
getStoredValues () | |
Static Public Member Functions | |
static | create (ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) |
Protected Attributes | |
$connection | |
$field_debugger | |
$records = NULL | |
![]() | |
$logger | |
$field_definitions = [] | |
$property_types = [] | |
addFieldDefinition (string $field_name, object $field_definition) | |
getStoredTypes () | |
insertValues (&$values) | |
updateValues (&$values) | |
loadValues (&$values) | |
deleteValues ($values) | |
findValues ($values) | |
validateValues ($values) | |
publishForm ($form, FormStateInterface &$form_state) | |
setPropValues (&$values, ChadoRecords $records) | |
buildChadoRecords ($values, bool $is_find=FALSE) | |
handleStoreID (array $context, StoragePropertyValue $prop_value) | |
handleStorePkey (array $context, StoragePropertyValue $prop_value) | |
handleStoreLink (array $context, StoragePropertyValue $prop_value) | |
handleStore (array $context, StoragePropertyValue $prop_value) | |
handleReadValue (array $context, StoragePropertyValue $prop_value) | |
parsePath (string $field_name, string $base_table, mixed $path, array $aliases=[], string $as='', string $full_path='') | |
getPathValueColumn (array $path) | |
handleJoins (array $path_array, array $context) | |
Additional Inherited Members | |
![]() | |
cloneValues ($values) | |
addEmptyValuesItem (&$values, $field_name) | |
Chado implementation of the TripalStorageInterface.
@TripalStorage( id = "chado_storage", label = @Translation("Chado Storage"), description = @Translation("Interfaces with GMOD Chado for field values."), )
Drupal\tripal_chado\Plugin\TripalStorage\ChadoStorage::__construct | ( | array | $configuration, |
$plugin_id, | |||
$plugin_definition, | |||
TripalLogger | $logger, | ||
ChadoConnection | $connection, | ||
ChadoFieldDebugger | $field_debugger | ||
) |
Implements __contruct().
Since we have implemented the ContainerFactoryPluginInterface, the constructor will be passed additional parameters added by the create() function. This allows our plugin to use dependency injection without our plugin manager service needing to worry about it.
array | $configuration | |
string | $plugin_id | |
mixed | $plugin_definition | |
\Drupal\tripal\Services\TripalLogger | $logger | |
\Drupal\tripal_chado\Database\ChadoConnection | $connection |
Drupal\tripal_chado\Plugin\TripalStorage\ChadoStorage::addFieldDefinition | ( | string | $field_name, |
object | $field_definition | ||
) |
inheritdoc}
Implements Drupal\tripal\TripalStorage\Interfaces\TripalStorageInterface.
|
protected |
Indexes a values array for easy lookup.
array | $values | Associative array 5-levels deep. The 1st level is the field name (e.g. ncbitaxon__common_name). The 2nd level is the delta value (e.g. 0). The 3rd level is a field key name (i.e. record_id and value). The 4th level must contain the following three keys/value pairs
|
bool | $is_find | Set to TRUE if we are building the record array for finding records. |
|
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 contructor.
\Symfony\Component\DependencyInjection\ContainerInterface | $container | |
array | $configuration | |
string | $plugin_id | |
mixed | $plugin_definition |
Reimplemented from Drupal\tripal\TripalStorage\TripalStorageBase.
Drupal\tripal_chado\Plugin\TripalStorage\ChadoStorage::deleteValues | ( | $values | ) |
inheritdoc}
Implements Drupal\tripal\TripalStorage\Interfaces\TripalStorageInterface.
Drupal\tripal_chado\Plugin\TripalStorage\ChadoStorage::findValues | ( | $values | ) |
inheritdoc}
Implements Drupal\tripal\TripalStorage\Interfaces\TripalStorageInterface.
|
protected |
A helper function to quickly get the value column information from a path.
array | $path | The parsed path of the field property. |
Drupal\tripal_chado\Plugin\TripalStorage\ChadoStorage::getStoredTypes | ( | ) |
Returns a list of property types that should be stored.In order to link data in the storage backend, the storage system must link the record in someway with Drupal entities. This most likely happens in tables in the Drupal schema (usually the public
schema). This function should return the list of properties that must be stored in order to uniquely identify an entity in the datastore.
Implements Drupal\tripal\TripalStorage\Interfaces\TripalStorageInterface.
|
protected |
A helper function for the buildChadoRecords() function.
Adds the joins to the ChadoRecord object.
array | $path_array | The join path array |
array | $context | The field/property context provided by the buildChadoRecords() function. |
|
protected |
A helper function for the buildChadoRecords() function.
Add chado record information for a specific ChadoStorageProperty where the action is read_value.
READ_VALUE: selecting a single column. This cannot be used for inserting or updating values. Instead we use store actions for that. If reading a value from a non-base table, then the path should be provided.
array | $context | The field/property context provided by the buildChadoRecords() function. |
StoragePropertyValue | $prop_value | The value object for the property we are adding records for. Note: We will always have a StoragePropertyValue for a property even if the value is not set. This method is expected to check if the value is empty or not. |
|
protected |
A helper function for the buildChadoRecords() function.
Add chado record information for a specific ChadoStorageProperty where the action is store.
STORE: indicates that the value of this property can be loaded and stored in the Chado table indicated by this property.
array | $context | The field/property context provided by the buildChadoRecords() function. |
StoragePropertyValue | $prop_value | The value object for the property we are adding records for. Note: We will always have a StoragePropertyValue for a property even if the value is not set. This method is expected to check if the value is empty or not. |
|
protected |
A helper function for the buildChadoRecords() function.
Add chado record information for a specific ChadoStorageProperty where the action is store_id.
STORE ID: stores the primary key value for a core table in chado.
Note: There may be more core tables in properties for this field then just the base table. For example, a field involving a two-join linker table will include two core tables.
array | $context | The field/property context provided by the buildChadoRecords() function. |
StoragePropertyValue | $prop_value | The value object for the property we are adding records for. Note: We will always have a StoragePropertyValue for a property even if the value is not set. This method is expected to check if the value is empty or not. |
|
protected |
A helper function for the buildChadoRecords() function.
Add chado record information for a specific ChadoStorageProperty where the action is store_link.
STORE LINK: performs a join between two tables, one of which is a core table and one of which is a linking table. The value which is saved in this property is the left_table_id indicated in other key/value pairs.
NOTE: A JOIN is not added to the query but rather this property stores the id that a join would normally look up. This is much more performant.
array | $context | The field/property context provided by the buildChadoRecords() function. |
StoragePropertyValue | $prop_value | The value object for the property we are adding records for. Note: We will always have a StoragePropertyValue for a property even if the value is not set. This method is expected to check if the value is empty or not. |
|
protected |
A helper function for the buildChadoRecords() function.
Add chado record information for a specific ChadoStorageProperty where the action is store_pkey.
STORE PKEY: stores the primary key value of a linking table.
NOTE: A linking table is not a core table. This is important because during insert and update, the core tables are handled first and then linking tables are handled after.
array | $context | The field/property context provided by the buildChadoRecords() function. |
StoragePropertyValue | $prop_value | The value object for the property we are adding records for. Note: We will always have a StoragePropertyValue for a property even if the value is not set. This method is expected to check if the value is empty or not. |
Drupal\tripal_chado\Plugin\TripalStorage\ChadoStorage::insertValues | ( | & | $values | ) |
inheritdoc}
Implements Drupal\tripal\TripalStorage\Interfaces\TripalStorageInterface.
Drupal\tripal_chado\Plugin\TripalStorage\ChadoStorage::loadValues | ( | & | $values | ) |
inheritdoc}
Implements Drupal\tripal\TripalStorage\Interfaces\TripalStorageInterface.
|
protected |
Takes a path string for a field property and converts it to an array structure.
mixed | $path | A string continaining the path. Note: this is a recursive function and on recursive calls this variable will be n array. Hence, the type is "mixed".* |
array | $aliases | Optional. The list of table aliases provdied by the table_alias_mapping argument of a field. If this variable is an empty array then the function will use the table name provided in the path. |
string | $as | An alias to be used for the Chado table column that contains the value. This argument will rename the column. |
string | $full_path | This argument is used by recursion to build the string path for each level. It should not be set by the callee. |
Drupal\tripal_chado\Plugin\TripalStorage\ChadoStorage::publishForm | ( | $form, | |
FormStateInterface & | $form_state | ||
) |
Provides form elements to be added to the Tripal entity publish form.
array | $form | The form array definition. |
\Drupal\Core\Form\FormStateInterface | $form_state | The form state object. |
Implements Drupal\tripal\TripalStorage\Interfaces\TripalStorageInterface.
|
protected |
Sets the property values using the records returned from Chado.
array | $values | Array of \Drupal\tripal\TripalStorage\StoragePropertyValue objects. |
ChadoRecords | $records | An instance of a ChadoRecords object from which values will be pulled. We don't use the built in member variable and instead allow it to be passed in because the findValues() functino can generate copies of the $records array and use that to set multiple values. |
Drupal\tripal_chado\Plugin\TripalStorage\ChadoStorage::updateValues | ( | & | $values | ) |
inheritdoc}
Implements Drupal\tripal\TripalStorage\Interfaces\TripalStorageInterface.
Drupal\tripal_chado\Plugin\TripalStorage\ChadoStorage::validateValues | ( | $values | ) |
Performs validation checks on values.
array | $values | Array of \Drupal\tripal\TripalStorage\StoragePropertyValue objects. |
Implements Drupal\tripal\TripalStorage\Interfaces\TripalStorageInterface.