mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-11-18 15:39:50 +00:00
Small experimental cleaning up.
This commit is contained in:
@@ -63,11 +63,11 @@ class TransactionJournal implements TransactionJournalInterface, CUDInterface, C
|
||||
*/
|
||||
public function store(array $data)
|
||||
{
|
||||
$currency = $this->getJournalCurrency($data['currency']);
|
||||
$journal = new \TransactionJournal(
|
||||
$journal = new \TransactionJournal(
|
||||
[
|
||||
'transaction_type_id' => $data['transaction_type_id'],
|
||||
'transaction_currency_id' => $currency->id, 'user_id' => $this->getUser()->id,
|
||||
'transaction_currency_id' => $data['transaction_currency_id'],
|
||||
'user_id' => $this->getUser()->id,
|
||||
'description' => $data['description'], 'date' => $data['date'], 'completed' => 0]
|
||||
);
|
||||
$journal->save();
|
||||
@@ -178,19 +178,6 @@ class TransactionJournal implements TransactionJournalInterface, CUDInterface, C
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $currency
|
||||
*
|
||||
* @return null|\TransactionCurrency
|
||||
*/
|
||||
public function getJournalCurrency($currency)
|
||||
{
|
||||
/** @var \FireflyIII\Database\TransactionCurrency\TransactionCurrency $currencyRepository */
|
||||
$currencyRepository = \App::make('FireflyIII\Database\TransactionCurrency\TransactionCurrency');
|
||||
|
||||
return $currencyRepository->findByCode($currency);
|
||||
}
|
||||
|
||||
/**
|
||||
* @SuppressWarnings("CyclomaticComplexity") // It's exactly 5. So I don't mind.
|
||||
*
|
||||
@@ -304,6 +291,19 @@ class TransactionJournal implements TransactionJournalInterface, CUDInterface, C
|
||||
return $typeRepository->findByWhat($type);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $currency
|
||||
*
|
||||
* @return null|\TransactionCurrency
|
||||
*/
|
||||
public function getJournalCurrency($currency)
|
||||
{
|
||||
/** @var \FireflyIII\Database\TransactionCurrency\TransactionCurrency $currencyRepository */
|
||||
$currencyRepository = \App::make('FireflyIII\Database\TransactionCurrency\TransactionCurrency');
|
||||
|
||||
return $currencyRepository->findByCode($currency);
|
||||
}
|
||||
|
||||
/**
|
||||
* @SuppressWarnings("CamelCase") // I'm fine with this.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user