Updates for new Sandstorm package.

This commit is contained in:
James Cole
2018-07-24 20:30:52 +02:00
parent 871033501a
commit 086eccaf4a
10 changed files with 83 additions and 93 deletions

View File

@@ -86,7 +86,7 @@ class ImportJobRepository implements ImportJobRepositoryInterface
while ($count < 30) {
$key = Str::random(12);
$existing = $this->findByKey($key);
if (null === $existing->id) {
if (null === $existing) {
$importJob = ImportJob::create(
[
'user_id' => $this->user->id,
@@ -114,15 +114,14 @@ class ImportJobRepository implements ImportJobRepositoryInterface
/**
* @param string $key
*
* @return ImportJob
* @deprecated
* @return ImportJob|null
*/
public function findByKey(string $key): ImportJob
public function findByKey(string $key): ?ImportJob
{
/** @var ImportJob $result */
$result = $this->user->importJobs()->where('key', $key)->first(['import_jobs.*']);
if (null === $result) {
return new ImportJob;
return null;
}
return $result;

View File

@@ -54,11 +54,9 @@ interface ImportJobRepositoryInterface
/**
* @param string $key
*
* @return ImportJob
* @deprecated
* @return ImportJob|null
*/
public function findByKey(string $key): ImportJob;
public function findByKey(string $key): ?ImportJob;
/**
* Return all attachments for job.