Tripal
|
Public Member Functions | |
__construct (ChadoConnection $connection, TripalLogger $logger) | |
addFieldToDebugger (string $field_name) | |
reportValues (array $values, string $message) | |
summarizeChadoStorage (ChadoStorage $chadostorage, $message) | |
summarizeBuiltRecords (ChadoRecords $records) | |
reportQuery (object $query, $message) | |
printHeader (string $process_name) | |
printText (string $text) | |
Public Attributes | |
ChadoConnection | $chado_connection |
TripalLogger | $logger |
array | $fields2debug = [] |
bool | $has_fields2debug = FALSE |
Provides debugging functionality for Chado data loading in fields extending the ChadoFieldItemBase that use properties to automatically load the data.
THIS SERVICE SHOULD ONLY BE CALLED BY CHADO STORAGE.
If you are a developer of a field looking for debugging information, you should set the $debug variable to TRUE in your field type class.
This variable will be used by ChadoStorage to tell the ChadoFieldDebugger service to display debugging information. All you need to do as a developer is set this variable to TRUE in your field and debuggin information will be displayed on the screen and in the drupal logs when you create, edit, and load content that has you field attached.
Drupal\tripal_chado\Services\ChadoFieldDebugger::__construct | ( | ChadoConnection | $connection, |
TripalLogger | $logger | ||
) |
Object constructor for the Chado Field debugger
Drupal |
Drupal\tripal_chado\Services\ChadoFieldDebugger::addFieldToDebugger | ( | string | $field_name | ) |
A way for ChadoStorage to tell this service which fields should be debugged.
Drupal\tripal_chado\Services\ChadoFieldDebugger::printHeader | ( | string | $process_name | ) |
Print some sort of header to make reading all the output easier ;-p
Drupal\tripal_chado\Services\ChadoFieldDebugger::printText | ( | string | $text | ) |
Print random debugging text.
Drupal\tripal_chado\Services\ChadoFieldDebugger::reportQuery | ( | object | $query, |
$message | |||
) |
This function will print out the query generated by the query builder. It is expected that this function will be called right before query->execute() is called in all the ChadoStorage::*ChadoRecord() methods.
object | $query | This is the object built by the dynamic query builder. For example, if you are generating a select query then this is the object created by ChadoConnection::select() after all fields, conditions and joins have been added to it. |
string | $message | This is a simple string to indicate who called this method. |
We would like to complete print out the query with subbed in parameters but it's driving me crazy.
Usually we would use $query->arguments() to get the arguments with placeholders but there are a number of bugs here:
$quoted = []; foreach ((array) $query->arguments() as $index => $val) { $key = 'db_placeholder_' . $index; $quoted[$key] = is_null($val) ? 'NULL' : $this->chado_connection->quote($val); } $sql = strtr($sql, $quoted);
Drupal\tripal_chado\Services\ChadoFieldDebugger::reportValues | ( | array | $values, |
string | $message | ||
) |
Prints out the values array in a readable manner for debuggin purposes. This is called by ChadoStorage::buildChadoRecords().
Drupal\tripal_chado\Services\ChadoFieldDebugger::summarizeBuiltRecords | ( | ChadoRecords | $records | ) |
This will summarize the results of ChadoStorage::buildChadoRecords().
array | $records | This is an instance of the TripalStorage ChadoRecords class which contains all the information of records to be inserted/modifiedin chado. generated using the Drupal Query Builder in the ChadoStorage::*Values() methods. |
Drupal\tripal_chado\Services\ChadoFieldDebugger::summarizeChadoStorage | ( | ChadoStorage | $chadostorage, |
$message | |||
) |
Summarize the current state of chadostorage.
ChadoStorage | $chadostorage | The current chadostorage object for interrogation. |
string | $message | A short message describing where this method was called from. |
ChadoConnection Drupal\tripal_chado\Services\ChadoFieldDebugger::$chado_connection |
The chado connection used to query chado.
array Drupal\tripal_chado\Services\ChadoFieldDebugger::$fields2debug = [] |
An array of field names to enable debugging information for.
Note: This will be set by chado storage based on the field annotation.
bool Drupal\tripal_chado\Services\ChadoFieldDebugger::$has_fields2debug = FALSE |
A simple flag to indicate if there are any fields to be debugged for performances sake.
TripalLogger Drupal\tripal_chado\Services\ChadoFieldDebugger::$logger |
The logger class to use to providing our debugging messages to the developer.