Tripal
Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
Drupal\tripal_chado\ChadoCustomTables\ChadoCustomTable Class Reference
Inheritance diagram for Drupal\tripal_chado\ChadoCustomTables\ChadoCustomTable:
Inheritance graph
[legend]

Public Member Functions

 __construct ($table_name, string $chado_schema=NULL)
 
 getTableId ()
 
 getTableName ()
 
 getChadoSchema ()
 
 setHidden ($hide=False)
 
 isHidden ()
 
 getTableSchema ()
 
 setTableSchema ($table_schema, $force=False)
 
 delete ()
 

Static Public Member Functions

static validateTableSchema ($table_schema)
 

Protected Member Functions

 getChado ()
 

Constructor & Destructor Documentation

◆ __construct()

Drupal\tripal_chado\ChadoCustomTables\ChadoCustomTable::__construct (   $table_name,
string  $chado_schema = NULL 
)

Initializes the service object with a table name.

This object will work with the custom table in the default Chado schema. Be sure to call the setSchemaName() on the ChadoConnection object to ensure the custom table is managed in the correct Chado instance.

Parameters
string$table_nameThe name of the custom table.
string$chado_schemaOptional. The chado schema where the custom table will live. If no schema is specified then the default schema is used.

Reimplemented in Drupal\tripal_chado\ChadoCustomTables\ChadoMview.

Member Function Documentation

◆ delete()

Drupal\tripal_chado\ChadoCustomTables\ChadoCustomTable::delete ( )

Destroyes the custom table completely.

Tripal will no longer know about the table and the table will be removed from Chado. After this function is executed this object is no longer usable.

Returns
bool True if successful. False otherwise.

◆ getChado()

Drupal\tripal_chado\ChadoCustomTables\ChadoCustomTable::getChado ( )
protected

Returns a ChadoConnection object with the correct schema set.

This is just a helpder function for this class to make sure the Chado schema is set as requested anytime the object is needec.

Returns
\Drupal\tripal_chado\Database\ChadoConnection

◆ getChadoSchema()

Drupal\tripal_chado\ChadoCustomTables\ChadoCustomTable::getChadoSchema ( )

Retrieves the name of the Chado schema in which this table lives.

Returns
string

◆ getTableId()

Drupal\tripal_chado\ChadoCustomTables\ChadoCustomTable::getTableId ( )

Retrieves the numeric ID of the custom table.

Returns
integer

◆ getTableName()

Drupal\tripal_chado\ChadoCustomTables\ChadoCustomTable::getTableName ( )

Retrieves the name of the custom table.

Returns
string

◆ getTableSchema()

Drupal\tripal_chado\ChadoCustomTables\ChadoCustomTable::getTableSchema ( )

Retrieves the schema for the custom table.

If return value is empty then it means the table schema has not yet been provided or the init() function has not been called. Use the setTableSchema() function to provide one.

Returns
array

◆ isHidden()

Drupal\tripal_chado\ChadoCustomTables\ChadoCustomTable::isHidden ( )

Indicates if the custom table is hidden from the end-user.

Tables that are hidden are meant to be managed internally by the Tripal module that created it and should not be changed or deleted by the end-user.

◆ setHidden()

Drupal\tripal_chado\ChadoCustomTables\ChadoCustomTable::setHidden (   $hide = False)

Toggles the custom table's hidden stuats.

Tables that are hidden are meant to be managed internally by the Tripal module that created it and should not be changed or deleted by the end-user.

Parameters
bool$hideSet to True to hide the table. Set to False to show the table to the end-user.

◆ setTableSchema()

Drupal\tripal_chado\ChadoCustomTables\ChadoCustomTable::setTableSchema (   $table_schema,
  $force = False 
)

Sets the table schema.

When setting the table schema, the table will be created in the Chado schema if it doesn't exist. If the table does exist then the $force argument must be set to True and the table will be dropped and recreated. If not set to True then no change is made to the schema or the custom table. The force argument is to prevent accidental deletion and recreation of tables that may have data.

If a mistake was made in the schema definition and it needs correction make sure the $force argument is set to False. But be careful. If the schema does not properly match the table problems may occur when using the table later.

Parameters
array$schemaThe Drupal table schema array defining the table.
boolean$forceTrue if the custom table should be dropped and recreated if it already exists
Returns
boolean True on successfu

Reimplemented in Drupal\tripal_chado\ChadoCustomTables\ChadoMview.

◆ validateTableSchema()

static Drupal\tripal_chado\ChadoCustomTables\ChadoCustomTable::validateTableSchema (   $table_schema)
static

Ensures that the table schema is correctly formatted.

Returns a list of messages indicating if any errors are present.

Parameters
string$table_schemaThe Drupal table schema array defining the table.
Returns
array A list of error message strings indicating what is wrong with the schema. If the array is empty then no errors were detected.

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