mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-15 08:35:00 +00:00
Lots of new code for recurring transactions. #1469
This commit is contained in:
@@ -28,6 +28,7 @@ use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Models\TransactionJournal;
|
||||
use FireflyIII\Models\TransactionType;
|
||||
use FireflyIII\Services\Internal\Support\JournalServiceTrait;
|
||||
use FireflyIII\Services\Internal\Support\TransactionTypeTrait;
|
||||
use FireflyIII\User;
|
||||
use Log;
|
||||
|
||||
@@ -36,7 +37,7 @@ use Log;
|
||||
*/
|
||||
class TransactionJournalFactory
|
||||
{
|
||||
use JournalServiceTrait;
|
||||
use JournalServiceTrait, TransactionTypeTrait;
|
||||
/** @var User */
|
||||
private $user;
|
||||
|
||||
@@ -137,25 +138,4 @@ class TransactionJournalFactory
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the transaction type. Since this is mandatory, will throw an exception when nothing comes up. Will always
|
||||
* use TransactionType repository.
|
||||
*
|
||||
* @param string $type
|
||||
*
|
||||
* @return TransactionType
|
||||
* @throws FireflyException
|
||||
*/
|
||||
protected function findTransactionType(string $type): TransactionType
|
||||
{
|
||||
$factory = app(TransactionTypeFactory::class);
|
||||
$transactionType = $factory->find($type);
|
||||
if (null === $transactionType) {
|
||||
Log::error(sprintf('Could not find transaction type for "%s"', $type)); // @codeCoverageIgnore
|
||||
throw new FireflyException(sprintf('Could not find transaction type for "%s"', $type)); // @codeCoverageIgnore
|
||||
}
|
||||
|
||||
return $transactionType;
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user