mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-29 18:20:01 +00:00
First attempt at job to create transactions for recurring transactions.
This commit is contained in:
@@ -24,8 +24,13 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Console;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Jobs\CreateRecurringTransactions;
|
||||
use FireflyIII\Models\RecurrenceRepetition;
|
||||
use FireflyIII\Repositories\Recurring\RecurringRepositoryInterface;
|
||||
use Illuminate\Console\Scheduling\Schedule;
|
||||
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
|
||||
use Log;
|
||||
|
||||
/**
|
||||
* File to make sure commnds work.
|
||||
@@ -58,7 +63,43 @@ class Kernel extends ConsoleKernel
|
||||
*
|
||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
||||
*/
|
||||
protected function schedule(Schedule $schedule)
|
||||
protected function schedule(Schedule $schedule): void
|
||||
{
|
||||
$schedule->call(
|
||||
function () {
|
||||
// run for the entirety of 2018, just to see what happens
|
||||
$start = new Carbon('2018-01-01');
|
||||
$end = new Carbon('2018-12-31');
|
||||
while ($start <= $end) {
|
||||
Log::info(sprintf('Now at %s', $start->format('D Y-m-d')));
|
||||
$job = new CreateRecurringTransactions(clone $start);
|
||||
$job->handle();
|
||||
$start->addDay();
|
||||
}
|
||||
|
||||
}
|
||||
)->everyMinute();
|
||||
|
||||
//$schedule->job(new CreateRecurringTransactions(new Carbon))->everyMinute();
|
||||
|
||||
//$schedule->job(new CreateRecurringTransactions(new Carbon))->everyMinute();
|
||||
|
||||
|
||||
// $schedule->call(
|
||||
// function () {
|
||||
// // command to do something
|
||||
// Log::debug('Schedule creation of transactions yaay!');
|
||||
// }
|
||||
// )->daily();
|
||||
//
|
||||
// $schedule->call(
|
||||
// function () {
|
||||
// // command to do something
|
||||
// Log::debug('Every minute!');
|
||||
// }
|
||||
// )->everyMinute()
|
||||
// ->emailOutputTo('thege');
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user