Gets keys values that are in a database table.
Drupal\locale\StringInterface $string: The string object.
string $table: (optional) The table name.
array Array with key fields if the string has all keys, or empty array if not.
protected function dbStringKeys($string, $table = NULL) {
$table = $table ? $table : $this
->dbStringTable($string);
if ($table && ($schema = drupal_get_schema($table))) {
$keys = $schema['primary key'];
$values = $string
->getValues($keys);
if (count($values) == count($keys)) {
return $values;
}
}
return NULL;
}