Use different method for finding objects.

This commit is contained in:
James Cole
2018-02-28 20:23:45 +01:00
parent fdd2dedfc6
commit 54ba18975a
10 changed files with 36 additions and 38 deletions

View File

@@ -47,7 +47,7 @@ class JavascriptController extends Controller
{
$accounts = $repository->getAccountsByType([AccountType::DEFAULT, AccountType::ASSET]);
$preference = Preferences::get('currencyPreference', config('firefly.default_currency', 'EUR'));
$default = $currencyRepository->findByCode($preference->data);
$default = $currencyRepository->findByCodeNull($preference->data);
$data = ['accounts' => []];
@@ -95,13 +95,13 @@ class JavascriptController extends Controller
*/
public function variables(Request $request, AccountRepositoryInterface $repository, CurrencyRepositoryInterface $currencyRepository)
{
$account = $repository->find(intval($request->get('account')));
$account = $repository->findNull(intval($request->get('account')));
$currencyId = 0;
if (null !== $account) {
$currencyId = intval($account->getMeta('currency_id'));
}
/** @var TransactionCurrency $currency */
$currency = $currencyRepository->find($currencyId);
$currency = $currencyRepository->findNull($currencyId);
if (0 === $currencyId) {
$currency = app('amount')->getDefaultCurrency();
}