mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-30 10:33:30 +00:00
Second fix for #2480
This commit is contained in:
@@ -85,10 +85,18 @@ class BackToJournals extends Command
|
|||||||
private function getIdsForBudgets(): array
|
private function getIdsForBudgets(): array
|
||||||
{
|
{
|
||||||
$transactions = DB::table('budget_transaction')->distinct()->get(['transaction_id'])->pluck('transaction_id')->toArray();
|
$transactions = DB::table('budget_transaction')->distinct()->get(['transaction_id'])->pluck('transaction_id')->toArray();
|
||||||
|
$array = [];
|
||||||
|
$chunks = array_chunk($transactions, 50);
|
||||||
|
|
||||||
return DB::table('transactions')
|
foreach ($chunks as $chunk) {
|
||||||
->whereIn('transactions.id', $transactions)
|
$set = DB::table('transactions')
|
||||||
|
->whereIn('transactions.id', $chunk)
|
||||||
->get(['transaction_journal_id'])->pluck('transaction_journal_id')->toArray();
|
->get(['transaction_journal_id'])->pluck('transaction_journal_id')->toArray();
|
||||||
|
/** @noinspection SlowArrayOperationsInLoopInspection */
|
||||||
|
$array = array_merge($array, $set);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $array;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -97,12 +105,18 @@ class BackToJournals extends Command
|
|||||||
private function getIdsForCategories(): array
|
private function getIdsForCategories(): array
|
||||||
{
|
{
|
||||||
$transactions = DB::table('category_transaction')->distinct()->get(['transaction_id'])->pluck('transaction_id')->toArray();
|
$transactions = DB::table('category_transaction')->distinct()->get(['transaction_id'])->pluck('transaction_id')->toArray();
|
||||||
|
$array = [];
|
||||||
|
$chunks = array_chunk($transactions, 50);
|
||||||
|
|
||||||
return DB::table('transactions')
|
foreach ($chunks as $chunk) {
|
||||||
|
$set = DB::table('transactions')
|
||||||
->whereIn('transactions.id', $transactions)
|
->whereIn('transactions.id', $transactions)
|
||||||
->get(['transaction_journal_id'])->pluck('transaction_journal_id')->toArray();
|
->get(['transaction_journal_id'])->pluck('transaction_journal_id')->toArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return $array;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
|
Reference in New Issue
Block a user