mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
Completely removed account crud class.
This commit is contained in:
@@ -13,7 +13,6 @@ declare(strict_types = 1);
|
||||
|
||||
namespace FireflyIII\Import\Converter;
|
||||
|
||||
use FireflyIII\Crud\Account\AccountCrudInterface;
|
||||
use FireflyIII\Models\Account;
|
||||
use FireflyIII\Models\AccountType;
|
||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||
@@ -43,9 +42,6 @@ class AssetAccountIban extends BasicConverter implements ConverterInterface
|
||||
return new Account;
|
||||
}
|
||||
|
||||
/** @var AccountCrudInterface $crud */
|
||||
$crud = app(AccountCrudInterface::class, [$this->user]);
|
||||
|
||||
/** @var AccountRepositoryInterface $repository */
|
||||
$repository = app(AccountRepositoryInterface::class, [$this->user]);
|
||||
|
||||
@@ -71,7 +67,7 @@ class AssetAccountIban extends BasicConverter implements ConverterInterface
|
||||
}
|
||||
|
||||
|
||||
$account = $crud->store(
|
||||
$account = $repository->store(
|
||||
['name' => 'Asset account with IBAN ' . $value, 'iban' => $value, 'user' => $this->user->id, 'accountType' => 'asset', 'virtualBalance' => 0,
|
||||
'active' => true, 'openingBalance' => 0]
|
||||
);
|
||||
|
@@ -13,7 +13,6 @@ declare(strict_types = 1);
|
||||
|
||||
namespace FireflyIII\Import\Converter;
|
||||
|
||||
use FireflyIII\Crud\Account\AccountCrudInterface;
|
||||
use FireflyIII\Models\Account;
|
||||
use FireflyIII\Models\AccountType;
|
||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||
@@ -43,9 +42,6 @@ class AssetAccountName extends BasicConverter implements ConverterInterface
|
||||
return new Account;
|
||||
}
|
||||
|
||||
/** @var AccountCrudInterface $crud */
|
||||
$crud = app(AccountCrudInterface::class, [$this->user]);
|
||||
|
||||
/** @var AccountRepositoryInterface $repository */
|
||||
$repository = app(AccountRepositoryInterface::class, [$this->user]);
|
||||
|
||||
@@ -70,7 +66,7 @@ class AssetAccountName extends BasicConverter implements ConverterInterface
|
||||
}
|
||||
|
||||
|
||||
$account = $crud->store(
|
||||
$account = $repository->store(
|
||||
['name' => $value, 'iban' => null, 'openingBalance' => 0, 'user' => $this->user->id, 'accountType' => 'asset', 'virtualBalance' => 0,
|
||||
'active' => true]
|
||||
);
|
||||
|
@@ -13,7 +13,6 @@ declare(strict_types = 1);
|
||||
|
||||
namespace FireflyIII\Import\Converter;
|
||||
|
||||
use FireflyIII\Crud\Account\AccountCrudInterface;
|
||||
use FireflyIII\Models\Account;
|
||||
use FireflyIII\Models\AccountType;
|
||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||
@@ -41,9 +40,6 @@ class AssetAccountNumber extends BasicConverter implements ConverterInterface
|
||||
return new Account;
|
||||
}
|
||||
|
||||
/** @var AccountCrudInterface $crud */
|
||||
$crud = app(AccountCrudInterface::class, [$this->user]);
|
||||
|
||||
/** @var AccountRepositoryInterface $repository */
|
||||
$repository = app(AccountRepositoryInterface::class, [$this->user]);
|
||||
|
||||
@@ -78,7 +74,7 @@ class AssetAccountNumber extends BasicConverter implements ConverterInterface
|
||||
}
|
||||
|
||||
|
||||
$account = $crud->store(
|
||||
$account = $repository->store(
|
||||
['name' => $accountName, 'openingBalance' => 0, 'iban' => null, 'user' => $this->user->id,
|
||||
'accountType' => 'asset',
|
||||
'virtualBalance' => 0, 'accountNumber' => $value, 'active' => true]
|
||||
|
@@ -13,7 +13,6 @@ declare(strict_types = 1);
|
||||
|
||||
namespace FireflyIII\Import\Converter;
|
||||
|
||||
use FireflyIII\Crud\Account\AccountCrudInterface;
|
||||
use FireflyIII\Models\Account;
|
||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||
use Log;
|
||||
@@ -42,9 +41,6 @@ class OpposingAccountIban extends BasicConverter implements ConverterInterface
|
||||
return new Account;
|
||||
}
|
||||
|
||||
/** @var AccountCrudInterface $crud */
|
||||
$crud = app(AccountCrudInterface::class, [$this->user]);
|
||||
|
||||
/** @var AccountRepositoryInterface $repository */
|
||||
$repository = app(AccountRepositoryInterface::class, [$this->user]);
|
||||
|
||||
@@ -73,7 +69,7 @@ class OpposingAccountIban extends BasicConverter implements ConverterInterface
|
||||
return $account;
|
||||
}
|
||||
|
||||
$account = $crud->store(
|
||||
$account = $repository->store(
|
||||
['name' => $value, 'iban' => $value, 'user' => $this->user->id, 'accountType' => 'import', 'virtualBalance' => 0, 'active' => true,
|
||||
'openingBalance' => 0]
|
||||
);
|
||||
|
@@ -13,7 +13,6 @@ declare(strict_types = 1);
|
||||
|
||||
namespace FireflyIII\Import\Converter;
|
||||
|
||||
use FireflyIII\Crud\Account\AccountCrudInterface;
|
||||
use FireflyIII\Models\Account;
|
||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||
use Log;
|
||||
@@ -42,9 +41,6 @@ class OpposingAccountName extends BasicConverter implements ConverterInterface
|
||||
return new Account;
|
||||
}
|
||||
|
||||
/** @var AccountCrudInterface $crud */
|
||||
$crud = app(AccountCrudInterface::class, [$this->user]);
|
||||
|
||||
/** @var AccountRepositoryInterface $repository */
|
||||
$repository = app(AccountRepositoryInterface::class, [$this->user]);
|
||||
|
||||
@@ -73,7 +69,7 @@ class OpposingAccountName extends BasicConverter implements ConverterInterface
|
||||
return $account;
|
||||
}
|
||||
|
||||
$account = $crud->store(
|
||||
$account = $repository->store(
|
||||
['name' => $value, 'iban' => null, 'user' => $this->user->id, 'accountType' => 'import', 'virtualBalance' => 0, 'active' => true,
|
||||
'openingBalance' => 0,
|
||||
]
|
||||
|
@@ -13,7 +13,6 @@ declare(strict_types = 1);
|
||||
|
||||
namespace FireflyIII\Import\Converter;
|
||||
|
||||
use FireflyIII\Crud\Account\AccountCrudInterface;
|
||||
use FireflyIII\Models\Account;
|
||||
use FireflyIII\Models\AccountType;
|
||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||
@@ -43,9 +42,6 @@ class OpposingAccountNumber extends BasicConverter implements ConverterInterface
|
||||
return new Account;
|
||||
}
|
||||
|
||||
/** @var AccountCrudInterface $crud */
|
||||
$crud = app(AccountCrudInterface::class, [$this->user]);
|
||||
|
||||
/** @var AccountRepositoryInterface $repository */
|
||||
$repository = app(AccountRepositoryInterface::class, [$this->user]);
|
||||
|
||||
@@ -81,7 +77,7 @@ class OpposingAccountNumber extends BasicConverter implements ConverterInterface
|
||||
}
|
||||
|
||||
|
||||
$account = $crud->store(
|
||||
$account = $repository->store(
|
||||
['name' => $accountName, 'openingBalance' => 0, 'iban' => null, 'user' => $this->user->id,
|
||||
'accountType' => 'import',
|
||||
'virtualBalance' => 0, 'accountNumber' => $value, 'active' => true]
|
||||
|
@@ -14,7 +14,6 @@ declare(strict_types = 1);
|
||||
namespace FireflyIII\Import;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Crud\Account\AccountCrudInterface;
|
||||
use FireflyIII\Models\Account;
|
||||
use FireflyIII\Models\AccountType;
|
||||
use FireflyIII\Models\ImportJob;
|
||||
@@ -176,8 +175,6 @@ class ImportValidator
|
||||
return $account;
|
||||
}
|
||||
// find it first by new type:
|
||||
/** @var AccountCrudInterface $crud */
|
||||
$crud = app(AccountCrudInterface::class, [$this->user]);
|
||||
|
||||
/** @var AccountRepositoryInterface $repository */
|
||||
$repository = app(AccountRepositoryInterface::class, [$this->user]);
|
||||
@@ -186,7 +183,7 @@ class ImportValidator
|
||||
if (is_null($result->id)) {
|
||||
// can convert account:
|
||||
Log::debug(sprintf('No account named %s of type %s, create new account.', $account->name, $type));
|
||||
$result = $crud->store(
|
||||
$result = $repository->store(
|
||||
[
|
||||
'user' => $this->user->id,
|
||||
'accountType' => config('firefly.shortNamesByFullName.' . $type),
|
||||
@@ -216,16 +213,13 @@ class ImportValidator
|
||||
private function fallbackExpenseAccount(): Account
|
||||
{
|
||||
|
||||
/** @var AccountCrudInterface $crud */
|
||||
$crud = app(AccountCrudInterface::class, [$this->user]);
|
||||
|
||||
/** @var AccountRepositoryInterface $repository */
|
||||
$repository = app(AccountRepositoryInterface::class, [$this->user]);
|
||||
|
||||
$name = 'Unknown expense account';
|
||||
$result = $repository->findByName($name, [AccountType::EXPENSE]);
|
||||
if (is_null($result->id)) {
|
||||
$result = $crud->store(
|
||||
$result = $repository->store(
|
||||
['name' => $name, 'iban' => null, 'openingBalance' => 0, 'user' => $this->user->id, 'accountType' => 'expense', 'virtualBalance' => 0,
|
||||
'active' => true]
|
||||
);
|
||||
@@ -240,9 +234,6 @@ class ImportValidator
|
||||
private function fallbackRevenueAccount(): Account
|
||||
{
|
||||
|
||||
/** @var AccountCrudInterface $crud */
|
||||
$crud = app(AccountCrudInterface::class, [$this->user]);
|
||||
|
||||
/** @var AccountRepositoryInterface $repository */
|
||||
$repository = app(AccountRepositoryInterface::class, [$this->user]);
|
||||
|
||||
@@ -251,7 +242,7 @@ class ImportValidator
|
||||
|
||||
|
||||
if (is_null($result->id)) {
|
||||
$result = $crud->store(
|
||||
$result = $repository->store(
|
||||
['name' => $name, 'iban' => null, 'openingBalance' => 0, 'user' => $this->user->id, 'accountType' => 'revenue', 'virtualBalance' => 0,
|
||||
'active' => true]
|
||||
);
|
||||
|
Reference in New Issue
Block a user