ImportSource: there is no end_time in ImportRun

This commit is contained in:
Thomas Gelf 2016-06-24 17:01:47 +02:00
parent 20197e1c9c
commit 39cf0a5fb8
1 changed files with 4 additions and 4 deletions

View File

@ -29,7 +29,7 @@ class ImportSource extends DbObjectWithSettings
protected $settingsRemoteId = 'source_id';
public function fetchLatestRun()
public function fetchLastRun()
{
return $this->fetchLastRunBefore(time());
}
@ -49,14 +49,14 @@ class ImportSource extends DbObjectWithSettings
array('ir' => 'import_run'),
'ir.id'
)->where('ir.source_id = ?', $this->id)
->where('ir.end_time < ?', date('Y-m-d H:i:s', $timestamp))
->order('ir.end_time DESC')
->where('ir.start_time < ?', date('Y-m-d H:i:s', $timestamp))
->order('ir.start_time DESC')
->limit(1);
$runId = $db->fetchOne($query);
if ($runId) {
return ImportRun::fromDb($this->connection);
return ImportRun::load($runId, $this->getConnection());
} else {
return null;
}