public static function ProblemsStorage::load_problem_stats in Node Accessibility 8
Loads stats for a particular node validation result.
Parameters
int $nid: The node id.
int $vid: The node revision id.
Return value
array An array of database results.
1 call to ProblemsStorage::load_problem_stats()
- NodeAccessibilityController::revisionOverview in src/
Controller/ NodeAccessibilityController.php - Generates an overview table of older revisions of a node.
File
- src/
ProblemsStorage.php, line 625
Class
- ProblemsStorage
- Class DatabaseStorage.
Namespace
Drupal\node_accessibilityCode
public static function load_problem_stats($nid, $vid) {
$results = [
'nid' => NULL,
'vid' => NULL,
'uid' => NULL,
'timestamp' => NULL,
];
if (!is_int($nid) || !is_int($vid)) {
return $results;
}
$results['nid'] = $nid;
$results['vid'] = $vid;
try {
$query = \Drupal::database()
->select('node_accessibility_stats', 'nas');
$query
->fields('nas', [
'uid',
'timestamp',
]);
$query
->condition('nas.nid', $nid);
$query
->condition('nas.vid', $vid);
$result = $query
->execute()
->fetchObject();
if ($result) {
$results['uid'] = $result->uid;
$results['timestamp'] = $result->timestamp;
}
} catch (Exception $e) {
$transaction
->rollback();
\Drupal::logger('node_accessibility')
->error("Failed to load accessibility validation stats for nid=@nid, vid=@vid.", [
'@nid' => $nid,
'@vid' => $vid,
]);
} catch (Error $e) {
$transaction
->rollback();
\Drupal::logger('node_accessibility')
->error("Failed to load accessibility validation stats for nid=@nid, vid=@vid.", [
'@nid' => $nid,
'@vid' => $vid,
]);
}
return $results;
}