mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
Updates for new Sandstorm package.
This commit is contained in:
@@ -371,10 +371,9 @@ class AccountRepository implements AccountRepositoryInterface
|
||||
* Returns the date of the very first transaction in this account.
|
||||
*
|
||||
* @param Account $account
|
||||
* @deprecated
|
||||
* @return TransactionJournal
|
||||
* @return TransactionJournal|null
|
||||
*/
|
||||
public function oldestJournal(Account $account): TransactionJournal
|
||||
public function oldestJournal(Account $account): ?TransactionJournal
|
||||
{
|
||||
$first = $account->transactions()
|
||||
->leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id')
|
||||
@@ -387,7 +386,7 @@ class AccountRepository implements AccountRepositoryInterface
|
||||
return TransactionJournal::find((int)$first->id);
|
||||
}
|
||||
|
||||
return new TransactionJournal();
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -402,7 +401,7 @@ class AccountRepository implements AccountRepositoryInterface
|
||||
{
|
||||
$result = new Carbon;
|
||||
$journal = $this->oldestJournal($account);
|
||||
if (null !== $journal->id) {
|
||||
if (null !== $journal) {
|
||||
$result = $journal->date;
|
||||
}
|
||||
|
||||
|
@@ -164,10 +164,9 @@ interface AccountRepositoryInterface
|
||||
* Returns the date of the very first transaction in this account.
|
||||
*
|
||||
* @param Account $account
|
||||
* @deprecated
|
||||
* @return TransactionJournal
|
||||
* @return TransactionJournal|null
|
||||
*/
|
||||
public function oldestJournal(Account $account): TransactionJournal;
|
||||
public function oldestJournal(Account $account): ?TransactionJournal;
|
||||
|
||||
/**
|
||||
* Returns the date of the very first transaction in this account.
|
||||
|
@@ -80,7 +80,7 @@ class AccountTasker implements AccountTaskerInterface
|
||||
$entry['end_balance'] = $endSet[$account->id] ?? '0';
|
||||
|
||||
// first journal exists, and is on start, then this is the actual opening balance:
|
||||
if (null !== $first->id && $first->date->isSameDay($start)) {
|
||||
if (null !== $first && $first->date->isSameDay($start)) {
|
||||
Log::debug(sprintf('Date of first journal for %s is %s', $account->name, $first->date->format('Y-m-d')));
|
||||
$entry['start_balance'] = $first->transactions()->where('account_id', $account->id)->first()->amount;
|
||||
Log::debug(sprintf('Account %s was opened on %s, so opening balance is %f', $account->name, $start->format('Y-m-d'), $entry['start_balance']));
|
||||
|
@@ -127,7 +127,6 @@ class AttachmentRepository implements AttachmentRepositoryInterface
|
||||
* @return string
|
||||
*
|
||||
* @throws \Illuminate\Contracts\Encryption\DecryptException
|
||||
* @throws \Illuminate\Contracts\Filesystem\FileNotFoundException
|
||||
*/
|
||||
public function getContent(Attachment $attachment): string
|
||||
{
|
||||
|
@@ -89,7 +89,7 @@ class ExportJobRepository implements ExportJobRepositoryInterface
|
||||
while ($count < 30) {
|
||||
$key = Str::random(12);
|
||||
$existing = $this->findByKey($key);
|
||||
if (null === $existing->id) {
|
||||
if (null === $existing) {
|
||||
$exportJob = new ExportJob;
|
||||
$exportJob->user()->associate($this->user);
|
||||
$exportJob->key = Str::random(12);
|
||||
@@ -121,16 +121,14 @@ class ExportJobRepository implements ExportJobRepositoryInterface
|
||||
|
||||
/**
|
||||
* @param string $key
|
||||
*
|
||||
* @deprecated
|
||||
* @return ExportJob
|
||||
* @return ExportJob|null
|
||||
*/
|
||||
public function findByKey(string $key): ExportJob
|
||||
public function findByKey(string $key): ?ExportJob
|
||||
{
|
||||
/** @var ExportJob $result */
|
||||
$result = $this->user->exportJobs()->where('key', $key)->first(['export_jobs.*']);
|
||||
if (null === $result) {
|
||||
return new ExportJob;
|
||||
return null;
|
||||
}
|
||||
|
||||
return $result;
|
||||
@@ -141,7 +139,6 @@ class ExportJobRepository implements ExportJobRepositoryInterface
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @throws \Illuminate\Contracts\Filesystem\FileNotFoundException
|
||||
*/
|
||||
public function getContent(ExportJob $job): string
|
||||
{
|
||||
|
@@ -58,11 +58,9 @@ interface ExportJobRepositoryInterface
|
||||
|
||||
/**
|
||||
* @param string $key
|
||||
*
|
||||
* @deprecated
|
||||
* @return ExportJob
|
||||
* @return ExportJob|null
|
||||
*/
|
||||
public function findByKey(string $key): ExportJob;
|
||||
public function findByKey(string $key): ?ExportJob;
|
||||
|
||||
/**
|
||||
* @param ExportJob $job
|
||||
|
@@ -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;
|
||||
|
@@ -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.
|
||||
|
@@ -187,7 +187,6 @@ class RecurringRepository implements RecurringRepositoryInterface
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
*
|
||||
* @throws FireflyException
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
|
Reference in New Issue
Block a user