-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from KurzGedanke/feature/send-band-start-notifi…
…cation Feature/send band start notification
- Loading branch information
Showing
3 changed files
with
99 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<?php | ||
|
||
namespace App\Command; | ||
|
||
use Symfony\Component\Console\Attribute\AsCommand; | ||
use Symfony\Component\Console\Command\Command; | ||
use Symfony\Component\Console\Input\InputInterface; | ||
use Symfony\Component\Console\Output\OutputInterface; | ||
use Symfony\Component\Console\Style\SymfonyStyle; | ||
use App\Repository\TimeSlotRepository; | ||
|
||
#[AsCommand( | ||
name: 'send:band-reminder', | ||
description: 'Add a short description for your command', | ||
)] | ||
class SendBandReminderCommand extends Command | ||
{ | ||
private TimeSlotRepository $timeSlotRepository; | ||
|
||
public function __construct(TimeSlotRepository $timeSlotRepository) | ||
{ | ||
$this->timeSlotRepository = $timeSlotRepository; | ||
parent::__construct(); | ||
} | ||
|
||
protected function configure(): void | ||
{ | ||
} | ||
|
||
protected function execute(InputInterface $input, OutputInterface $output): int | ||
{ | ||
$io = new SymfonyStyle($input, $output); | ||
date_default_timezone_set('Europe/Berlin'); | ||
|
||
$dateNow = date('Y-m-d H:i:00', time()); | ||
$dateLater = date('Y-m-d H:i:00', (time() + 5 * 60 )); | ||
|
||
$timeSlots = $this->timeSlotRepository->findNextTimeSlotsBasedOn5Minutes($dateNow, $dateLater); | ||
|
||
foreach ($timeSlots as $timeSlot) { | ||
$io->comment($timeSlot->getBand()->getName()); | ||
} | ||
|
||
$io->success($timeSlots); | ||
$io->success($dateNow); | ||
$io->success($dateLater); | ||
|
||
return Command::SUCCESS; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters