Tripal
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
Drupal\tripal_chado\Plugin\ChadoBuddy\ChadoPropertyBuddy Class Reference
Inheritance diagram for Drupal\tripal_chado\Plugin\ChadoBuddy\ChadoPropertyBuddy:
Inheritance graph
[legend]
Collaboration diagram for Drupal\tripal_chado\Plugin\ChadoBuddy\ChadoPropertyBuddy:
Collaboration graph
[legend]

Public Member Functions

 __construct (array $configuration, $plugin_id, $plugin_definition, ChadoConnection $connection, ChadoBuddyPluginManager $buddy_manager)
 
 getProperty (string $base_table, int $record_id, array $conditions, array $options=[])
 
 insertProperty (string $base_table, int $record_id, array $values, array $options=[])
 
 updateProperty (string $base_table, int $record_id, array $values, array $conditions, array $options=[])
 
 upsertProperty (string $base_table, int $record_id, array $values, array $options=[])
 
 deleteProperty (string $base_table, int $record_id, array $conditions, array $options=[])
 
- Public Member Functions inherited from Drupal\tripal_chado\ChadoBuddy\ChadoBuddyPluginBase
 __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)
 

Protected Attributes

object $buddy_manager
 
object $cvterm_instance
 

Additional Inherited Members

- Public Attributes inherited from Drupal\tripal_chado\ChadoBuddy\ChadoBuddyPluginBase
ChadoConnection $connection
 
- Protected Member Functions inherited from Drupal\tripal_chado\ChadoBuddy\ChadoBuddyPluginBase
 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)
 

Constructor & Destructor Documentation

◆ __construct()

Drupal\tripal_chado\Plugin\ChadoBuddy\ChadoPropertyBuddy::__construct ( array  $configuration,
  $plugin_id,
  $plugin_definition,
ChadoConnection  $connection,
ChadoBuddyPluginManager  $buddy_manager 
)

{}

Member Function Documentation

◆ create()

static Drupal\tripal_chado\Plugin\ChadoBuddy\ChadoPropertyBuddy::create ( ContainerInterface  $container,
array  $configuration,
  $plugin_id,
  $plugin_definition 
)
static

Implements ContainerFactoryPluginInterface->create().

We are injecting an additional dependency here, the ChadoBuddyPluginManager, so that this buddy can have access to the Dbxref buddy.

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.

Parameters
\Symfony\Component\DependencyInjection\ContainerInterface$container
array$configuration
string$plugin_id
mixed$plugin_definition
Returns
static
Exceptions
Drupal

tripal_chado\ChadoBuddy\Exceptions\ChadoBuddyException If an error is encountered.

Reimplemented from Drupal\tripal_chado\ChadoBuddy\ChadoBuddyPluginBase.

◆ deleteProperty()

Drupal\tripal_chado\Plugin\ChadoBuddy\ChadoPropertyBuddy::deleteProperty ( string  $base_table,
int  $record_id,
array  $conditions,
array  $options = [] 
)

Deletes a chado property or multiple properties.

Parameters
string$base_tableThe base table for which the property should be associated. Thus to associate a property with a feature, the basetable=feature and a record is added to the featureprop table.
int$record_idThe primary key of the basetable to that the property is associated with.
array$conditionsAn array where the key is a table+dot+column to describe the name of the property table and the column desired. Examples here are for the project table:
  • projectprop.projectprop_id - (optional) property table primary key value
  • projectprop.project_id - (optional) base table primary key value
  • projectprop.type_id - a foreign key to cvterm_id
  • projectprop.value - the value of the property
  • projectprop.rank - optional rank of the property
  • and possibly other columns for some property tables
  • cv.cv_id
  • cv.name
  • cv.definition
  • cvterm.cvterm_id
  • cvterm.cv_id
  • cvterm.name
  • cvterm.definition
  • cvterm.is_obsolete
  • cvterm.is_relationshiptype
  • dbxref.dbxref_id
  • dbxref.db_id
  • dbxref.description
  • dbxref.accession
  • dbxref.version
  • db.db_id
  • db.name
  • db.description
  • db.urlprefix
  • db.url
  • buddy_record = a ChadoBuddyRecord can be used in place of or in addition to other keys
array$options(Optional)
  • property_table - if the default of $base_table . 'prop' needs to be changed
  • fkey - if the default of $base_table . '_id' needs to be changed
  • pkey - if the default of $property_table . '_id' needs to be changed
  • max_delete - specifies the maximum number of properties that can be deleted. Default is 1. Set to -1 for unlimited. If the limit is exceeded, a ChadoBuddyException is thrown.
Returns
int Returns a count of the number of records that were deleted.
Exceptions
Drupal

tripal_chado\ChadoBuddy\Exceptions\ChadoBuddyException If an error is encountered.

◆ getProperty()

Drupal\tripal_chado\Plugin\ChadoBuddy\ChadoPropertyBuddy::getProperty ( string  $base_table,
int  $record_id,
array  $conditions,
array  $options = [] 
)

Retrieves a chado property.

Parameters
string$base_tableThe base table for which the property should be associated. Thus to associate a property with a feature, the basetable=feature and a record is added to the featureprop table.
int$record_idThe primary key of the basetable to that the property is associated with.
array$conditionsAn array where the key is a table+dot+column to describe the name of the property table and the column desired. Examples here are for the project table:
  • projectprop.projectprop_id - (optional) property table primary key value
  • projectprop.project_id - (optional) base table primary key value
  • projectprop.type_id - a foreign key to cvterm_id
  • projectprop.value - the value of the property
  • projectprop.rank - optional rank of the property
  • and possibly other columns for some property tables
  • cv.cv_id
  • cv.name
  • cv.definition
  • cvterm.cvterm_id
  • cvterm.cv_id
  • cvterm.name
  • cvterm.definition
  • cvterm.is_obsolete
  • cvterm.is_relationshiptype
  • dbxref.dbxref_id
  • dbxref.db_id
  • dbxref.description
  • dbxref.accession
  • dbxref.version
  • db.db_id
  • db.name
  • db.description
  • db.urlprefix
  • db.url
  • buddy_record = a ChadoBuddyRecord can be used in place of or in addition to other keys
array$options(Optional)
  • property_table - if the default of $base_table . 'prop' needs to be changed
  • fkey - if the default of $base_table . '_id' needs to be changed
  • pkey - if the default of $property_table . '_id' needs to be changed
Returns
bool|array|ChadoBuddyRecord An array of ChadoBuddyRecord objects. More specifically, (1) if the select values return a single record then we return an array containing a single ChadoBuddyRecord describing the record. (2) if the select values return multiple records, then we return an array of ChadoBuddyRecords describing the results. (3) if there are no results then we return an empty array.
Exceptions
Drupal

tripal_chado\ChadoBuddy\Exceptions\ChadoBuddyException If an error is encountered.

◆ insertProperty()

Drupal\tripal_chado\Plugin\ChadoBuddy\ChadoPropertyBuddy::insertProperty ( string  $base_table,
int  $record_id,
array  $values,
array  $options = [] 
)

Adds a new property linked to the specified base table and record

Parameters
string$base_tableThe base table for which the property should be associated. Thus to associate a property with a feature, the basetable=feature and a record is added to the featureprop table.
int$record_idThe primary key of the basetable to that the property is associated with.
$valuesAn array where the key is a table+dot+column to describe the name of the property table and the column desired. Examples here are for the project table:
  • projectprop.projectprop_id - (optional) property table primary key value
  • projectprop.project_id - (optional) base table primary key value
  • projectprop.type_id - a foreign key to cvterm_id
  • projectprop.value - the value of the property
  • projectprop.rank - optional rank of the property
  • and possibly other columns for some property tables
  • cv.cv_id
  • cv.name
  • cv.definition
  • cvterm.cvterm_id
  • cvterm.cv_id
  • cvterm.name
  • cvterm.definition
  • cvterm.is_obsolete
  • cvterm.is_relationshiptype
  • dbxref.dbxref_id
  • dbxref.db_id
  • dbxref.description
  • dbxref.accession
  • dbxref.version
  • db.db_id
  • db.name
  • db.description
  • db.urlprefix
  • db.url
  • buddy_record = a ChadoBuddyRecord can be used in place of or in addition to other keys
array$options(Optional)
  • property_table - if the default of $base_table . 'prop' needs to be changed
  • fkey - if the default of $base_table . '_id' needs to be changed
  • pkey - if the default of $property_table . '_id' needs to be changed
  • create_cvterm - set to TRUE (default FALSE) if you specified the necessary fields and want to create the dbxref and cvterm when creating this property, if they do not already exist.
Returns
ChadoBuddyRecord The inserted ChadoBuddyRecord will be returned on success and an exception will be thrown if an error is encountered. If the record already exists then an error will be thrown. If this is not the desired behaviour then use the upsert version of this method.
Exceptions
Drupal

tripal_chado\ChadoBuddy\Exceptions\ChadoBuddyException If an error is encountered.

◆ updateProperty()

Drupal\tripal_chado\Plugin\ChadoBuddy\ChadoPropertyBuddy::updateProperty ( string  $base_table,
int  $record_id,
array  $values,
array  $conditions,
array  $options = [] 
)

Updates an existing property.

Parameters
string$base_tableThe base table for which the property should be associated. Thus to associate a property with a feature, the basetable=feature and a record is added to the featureprop table.
int$record_idThe primary key of the basetable to that the property is associated with.
array$valuesValues for what you want the updated propert to contaion. An array where the key is a table+dot+column to describe the name of the property table and the column desired. Examples here are for the project table:
  • projectprop.projectprop_id - (optional) property table primary key value
  • projectprop.project_id - (optional) base table primary key value
  • projectprop.type_id - a foreign key to cvterm_id
  • projectprop.value - the value of the property
  • projectprop.rank - optional rank of the property
  • and possibly other columns for some property tables
  • cv.cv_id
  • cv.name
  • cv.definition
  • cvterm.cvterm_id
  • cvterm.cv_id
  • cvterm.name
  • cvterm.definition
  • cvterm.is_obsolete
  • cvterm.is_relationshiptype
  • dbxref.dbxref_id
  • dbxref.db_id
  • dbxref.description
  • dbxref.accession
  • dbxref.version
  • db.db_id
  • db.name
  • db.description
  • db.urlprefix
  • db.url
  • buddy_record = a ChadoBuddyRecord can be used in place of or in addition to other keys
array$conditionsAn associative array of the conditions to find the record to update. Although the same keys are supported as those indicated for the $values, only columns that are part of a unique constraint will be used for the database query. e.g. you can't query on the property value.
array$options(Optional)
  • property_table - if the default of $base_table . 'prop' needs to be changed
  • fkey - if the default of $base_table . '_id' needs to be changed
  • pkey - if the default of $property_table . '_id' needs to be changed
Returns
bool|ChadoBuddyRecord The updated ChadoBuddyRecord will be returned on success, FALSE will be returned if no record was found to update.
Exceptions
Drupal

tripal_chado\ChadoBuddy\Exceptions\ChadoBuddyException If an error is encountered.

◆ upsertProperty()

Drupal\tripal_chado\Plugin\ChadoBuddy\ChadoPropertyBuddy::upsertProperty ( string  $base_table,
int  $record_id,
array  $values,
array  $options = [] 
)

Insert a property if it doesn't yet exist OR update it if does.

Parameters
string$base_tableThe base table for which the property should be associated. Thus to associate a property with a feature, the basetable=feature and a record is added to the featureprop table.
int$record_idThe primary key of the basetable to that the property is associated with.
array$valuesAn array where the key is a table+dot+column to describe the name of the property table and the column desired. Examples here are for the project table:
  • projectprop.projectprop_id - (optional) property table primary key value
  • projectprop.project_id - (optional) base table primary key value
  • projectprop.type_id - a foreign key to cvterm_id
  • projectprop.value - the value of the property
  • projectprop.rank - optional rank of the property
  • and possibly other columns for some property tables
  • cv.cv_id
  • cv.name
  • cv.definition
  • cvterm.cvterm_id
  • cvterm.cv_id
  • cvterm.name
  • cvterm.definition
  • cvterm.is_obsolete
  • cvterm.is_relationshiptype
  • dbxref.dbxref_id
  • dbxref.db_id
  • dbxref.description
  • dbxref.accession
  • dbxref.version
  • db.db_id
  • db.name
  • db.description
  • db.urlprefix
  • db.url
  • buddy_record = a ChadoBuddyRecord can be used in place of or in addition to other keys
array$options(Optional)
  • property_table - if the default of $base_table . 'prop' needs to be changed
  • fkey - if the default of $base_table . '_id' needs to be changed
  • pkey - if the default of $property_table . '_id' needs to be changed
  • create_cvterm - set to TRUE (default FALSE) if you have the necessary fields and want to create the dbxref and cvterm when creating this property, if they do not already exist.
Returns
ChadoBuddyRecord The inserted/updated ChadoBuddyRecord will be returned on success.
Exceptions
Drupal

tripal_chado\ChadoBuddy\Exceptions\ChadoBuddyException If an error is encountered.

Member Data Documentation

◆ $buddy_manager

object Drupal\tripal_chado\Plugin\ChadoBuddy\ChadoPropertyBuddy::$buddy_manager
protected

Used to store the manager so we can access the Cvterm buddy

◆ $cvterm_instance

object Drupal\tripal_chado\Plugin\ChadoBuddy\ChadoPropertyBuddy::$cvterm_instance
protected

Cache the cvterm instance here


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