This commit is contained in:
52
src/Command/HiltesExportCommand.php
Normal file
52
src/Command/HiltesExportCommand.php
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
namespace App\Command;
|
||||
|
||||
use App\Repository\OrdersRepository;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Component\Console\Attribute\AsCommand;
|
||||
use Symfony\Component\Console\Command\Command;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Console\Style\SymfonyStyle;
|
||||
use App\Helper\Hiltes;
|
||||
|
||||
#[AsCommand(
|
||||
name: 'hiltes:export',
|
||||
description: 'Erstellt die Hiltes-Exportdatei aus den aktuellen Bestelldaten',
|
||||
)]
|
||||
class HiltesExportCommand extends Command
|
||||
{
|
||||
public function __construct(OrdersRepository $ordersRepository, LoggerInterface $logger)
|
||||
{
|
||||
$this->ordersRepository = $ordersRepository;
|
||||
$this->logger = $logger;
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
|
||||
protected function configure(): void
|
||||
{
|
||||
$this
|
||||
->addArgument('arg1', InputArgument::OPTIONAL, 'Argument description')
|
||||
->addOption('option1', null, InputOption::VALUE_NONE, 'Option description')
|
||||
;
|
||||
}
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output): int
|
||||
{
|
||||
$io = new SymfonyStyle($input, $output);
|
||||
|
||||
$hiltes = new Hiltes();
|
||||
|
||||
$hiltes->export('Test');
|
||||
|
||||
|
||||
$io->success('Done!');
|
||||
|
||||
return Command::SUCCESS;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user