Tripal
Loading...
Searching...
No Matches
List of all members
Drupal\tripal\Plugin\TripalStorage\DrupalSqlStorage Class Reference
Inheritance diagram for Drupal\tripal\Plugin\TripalStorage\DrupalSqlStorage:
Inheritance graph
[legend]
Collaboration diagram for Drupal\tripal\Plugin\TripalStorage\DrupalSqlStorage:
Collaboration graph
[legend]

Public Member Functions

 addTypes (string $field_name, array $types)
 
 updateValues (&$values)
 
 deleteValues ($values)
 
 findValues ($values)
 
 insertValues (&$values)
 
 loadValues (&$values, bool $ignore_cached_fields=TRUE)
 
 validateValues ($values)
 
 getStoredTypes ()
 
 getNonStoredTypes ()
 
- Public Member Functions inherited from Drupal\tripal\TripalStorage\TripalStorageBase
 __construct (array $configuration, $plugin_id, $plugin_definition, TripalLogger $logger)
 
 addFieldDefinition (string $field_name, object $field_definition)
 
 getFieldDefinition (string $field_name)
 
 getTypes ()
 
 getPropertyType (string $field_name, string $key)
 
 removeTypes (string $field_name, array $types)
 
 markPropertiesForCaching (string $field_name, array &$prop_types)
 
 isDrupalStoreByFieldNameKey (string $field_name, string $key, object|null $property_type=NULL)
 
 publishForm ($form, FormStateInterface &$form_state)
 
 publishFormValidate ($form, FormStateInterface &$form_state)
 
 publishFromSubmit ($form, FormStateInterface &$form_state)
 
- Public Member Functions inherited from Drupal\tripal\TripalStorage\Interfaces\TripalStorageInterface
 getStoredValues ()
 

Additional Inherited Members

- Static Public Member Functions inherited from Drupal\tripal\TripalStorage\TripalStorageBase
static create (ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition)
 
- Protected Member Functions inherited from Drupal\tripal\TripalStorage\TripalStorageBase
 cloneValues ($values)
 
 resetValuesItem (&$values, $field_name, $delta)
 
- Protected Attributes inherited from Drupal\tripal\TripalStorage\TripalStorageBase
 $logger
 
 $field_definitions = []
 
 $property_types = []
 
 $cached_fields = []
 
bool $default_is_required = TRUE
 

Member Function Documentation

◆ addTypes()

Drupal\tripal\Plugin\TripalStorage\DrupalSqlStorage::addTypes ( string  $field_name,
array  $types 
)

Adds the property type objects for the current field.

inheritdoc}

OVERRIDES TripalStorageBase to ensure all field properties are set to save to Drupal!

Reimplemented from Drupal\tripal\TripalStorage\TripalStorageBase.

◆ deleteValues()

Drupal\tripal\Plugin\TripalStorage\DrupalSqlStorage::deleteValues (   $values)

Deletes the given array of property values from this tripal storage plugin.

Parameters
array$valuesArray of \Drupal\tripal\TripalStorage\StoragePropertyValue objects.
Returns
bool True if successful. False otherwise.

Implements Drupal\tripal\TripalStorage\Interfaces\TripalStorageInterface.

◆ findValues()

Drupal\tripal\Plugin\TripalStorage\DrupalSqlStorage::findValues (   $values)

Finds all property values for this backend instance based on $values.

Parameters
array$valuesAssociative array 5-levels deep. The 1st level is the field name (e.g. ChadoOrganismDefault). The 2nd level is the delta value (e.g. 0). The 3rd level is a field key name (i.e. record_id + value). The 4th level must contain the following three keys/value pairs
  • "value": a \Drupal\tripal\TripalStorage\StoragePropertyValue object
  • "type": a\Drupal\tripal\TripalStorage\StoragePropertyType object
  • "definition": a \Drupal\Field\Entity\FieldConfig object When the function returns, any values retrieved from the data store will be set in the StoragePropertyValue object.
Returns
array An array of records that were found. Each record array is the same format as the $values argument but with all value objects set where values were found.

Todo:
implement this function properly

Implements Drupal\tripal\TripalStorage\Interfaces\TripalStorageInterface.

◆ getNonStoredTypes()

Drupal\tripal\Plugin\TripalStorage\DrupalSqlStorage::getNonStoredTypes ( )

Returns a list of property types that should not be stored in Drupal.This is the inverse of the getStoredTypes() method. It's needed because all field property types have a column in the Drupal table. However, the "Stored" ones save the value both in Drupal and in the storage backend and the "unstored" ones save an empty value in Drupal that is populated on load by the storage backend.

Returns
array Array of \Drupal\tripal\Base\StoragePropertyTypeBase objects.

Implements Drupal\tripal\TripalStorage\Interfaces\TripalStorageInterface.

◆ getStoredTypes()

Drupal\tripal\Plugin\TripalStorage\DrupalSqlStorage::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.

Returns
array Array of \Drupal\tripal\Base\StoragePropertyTypeBase objects.

Implements Drupal\tripal\TripalStorage\Interfaces\TripalStorageInterface.

◆ insertValues()

Drupal\tripal\Plugin\TripalStorage\DrupalSqlStorage::insertValues ( $values)

Inserts values in the field data store.The record Ids of the inserted records will be set in the property value objects.

Parameters
array$valuesAssociative array 5-levels deep. The 1st level is the field name (e.g. ChadoOrganismDefault). The 2nd level is the delta value (e.g. 0). The 3rd level is a field key name (i.e. record_id + value). The 4th level must contain the following three keys/value pairs
  • "value": a \Drupal\tripal\TripalStorage\StoragePropertyValue object
  • "type": a\Drupal\tripal\TripalStorage\StoragePropertyType object
  • "definition": a \Drupal\Field\Entity\FieldConfig object When the function returns, any values retrieved from the data store will be set in the StoragePropertyValue object.
Returns
bool True if successful. False otherwise.

Implements Drupal\tripal\TripalStorage\Interfaces\TripalStorageInterface.

◆ loadValues()

Drupal\tripal\Plugin\TripalStorage\DrupalSqlStorage::loadValues ( $values,
bool  $ignore_cached_fields = TRUE 
)

Loads the values of the field data store.

Parameters
array$valuesAssociative array 5-levels deep. The 1st level is the field name (e.g. ChadoOrganismDefault). The 2nd level is the delta value (e.g. 0). The 3rd level is a field key name (i.e. record_id + value). The 4th level must contain the following three keys/value pairs
  • "value": a \Drupal\tripal\TripalStorage\StoragePropertyValue object
  • "type": a\Drupal\tripal\TripalStorage\StoragePropertyType object
  • "definition": a \Drupal\Field\Entity\FieldConfig object.
bool$ignore_cached_fieldsIf TRUE then values from fully cached fields should be ignored as they will be loaded by Drupal; if FALSE then load them from the tripal storage backend.
Returns
bool True if successful. False otherwise.

Implements Drupal\tripal\TripalStorage\Interfaces\TripalStorageInterface.

◆ updateValues()

Drupal\tripal\Plugin\TripalStorage\DrupalSqlStorage::updateValues ( $values)

Updates values in the field data store.

Parameters
array$valuesAssociative array 5-levels deep. The 1st level is the field name (e.g. ChadoOrganismDefault). The 2nd level is the delta value (e.g. 0). The 3rd level is a field key name (i.e. record_id + value). The 4th level must contain the following three keys/value pairs
  • "value": a \Drupal\tripal\TripalStorage\StoragePropertyValue object
  • "type": a\Drupal\tripal\TripalStorage\StoragePropertyType object
  • "definition": a \Drupal\Field\Entity\FieldConfig object When the function returns, any values retrieved from the data store will be set in the StoragePropertyValue object.
Returns
bool True if successful. False otherwise.

Implements Drupal\tripal\TripalStorage\Interfaces\TripalStorageInterface.

◆ validateValues()

Drupal\tripal\Plugin\TripalStorage\DrupalSqlStorage::validateValues (   $values)

Performs validation checks on values.

Parameters
array$valuesArray of \Drupal\tripal\TripalStorage\StoragePropertyValue objects.
Returns
array An array of \Symfony\Component\Validator\ConstraintViolation objects.

Implements Drupal\tripal\TripalStorage\Interfaces\TripalStorageInterface.


The documentation for this class was generated from the following file: