mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-17 01:42:19 +00:00
Add some TODO's, refactor some code.
This commit is contained in:
@@ -157,6 +157,9 @@ class AccountRepository implements AccountRepositoryInterface
|
||||
Log::debug(sprintf('Searching for account named "%s" (of user #%d) of the following type(s)', $name, $this->user->id), ['types' => $types]);
|
||||
|
||||
$accounts = $query->get(['accounts.*']);
|
||||
|
||||
// TODO no longer need to loop like this
|
||||
|
||||
/** @var Account $account */
|
||||
foreach ($accounts as $account) {
|
||||
if ($account->name === $name) {
|
||||
@@ -308,6 +311,8 @@ class AccountRepository implements AccountRepositoryInterface
|
||||
*/
|
||||
public function getMetaValue(Account $account, string $field): ?string
|
||||
{
|
||||
// TODO no longer need to loop like this
|
||||
|
||||
foreach ($account->accountMeta as $meta) {
|
||||
if ($meta->name === $field) {
|
||||
return (string)$meta->data;
|
||||
@@ -406,6 +411,9 @@ class AccountRepository implements AccountRepositoryInterface
|
||||
/** @var AccountType $type */
|
||||
$type = AccountType::where('type', AccountType::RECONCILIATION)->first();
|
||||
$accounts = $this->user->accounts()->where('account_type_id', $type->id)->get();
|
||||
|
||||
// TODO no longer need to loop like this
|
||||
|
||||
/** @var Account $current */
|
||||
foreach ($accounts as $current) {
|
||||
if ($current->name === $name) {
|
||||
|
@@ -128,6 +128,8 @@ class BillRepository implements BillRepositoryInterface
|
||||
{
|
||||
$bills = $this->user->bills()->get(['bills.*']);
|
||||
|
||||
// TODO no longer need to loop like this
|
||||
|
||||
/** @var Bill $bill */
|
||||
foreach ($bills as $bill) {
|
||||
if ($bill->name === $name) {
|
||||
|
@@ -272,6 +272,9 @@ class CategoryRepository implements CategoryRepositoryInterface
|
||||
public function findByName(string $name): ?Category
|
||||
{
|
||||
$categories = $this->user->categories()->get(['categories.*']);
|
||||
|
||||
// TODO no longer need to loop like this
|
||||
|
||||
foreach ($categories as $category) {
|
||||
if ($category->name === $name) {
|
||||
return $category;
|
||||
|
@@ -199,6 +199,9 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface
|
||||
public function findByName(string $name): ?PiggyBank
|
||||
{
|
||||
$set = $this->user->piggyBanks()->get(['piggy_banks.*']);
|
||||
|
||||
// TODO no longer need to loop like this
|
||||
|
||||
/** @var PiggyBank $piggy */
|
||||
foreach ($set as $piggy) {
|
||||
if ($piggy->name === $name) {
|
||||
|
Reference in New Issue
Block a user