Db::fetchLatestImportedRows: nested key support

This commit is contained in:
Thomas Gelf 2015-11-25 21:01:11 +01:00
parent 7193ff07c4
commit 35776575a3
1 changed files with 15 additions and 1 deletions

View File

@ -178,9 +178,23 @@ class Db extends DbConnection
return $objects;
}
public function fetchLatestImportedRows($source, $columns = null)
public function fetchLatestImportedRows($source, $desiredColumns = null)
{
$db = $this->db();
if ($desiredColumns === null) {
$columns = null;
} else {
$columns = array();
foreach ($desiredColumns as $column) {
if (false === ($pos = strpos($column, '.'))) {
$columns[$column] = $column;
} else {
$column = substr($column, 0, $pos);
$columns[$column] = $column;
}
}
}
$lastRun = $db->select()->from('import_run', array('rowset_checksum'));
if (is_int($source) || ctype_digit($source)) {