Slack notify
This commit is contained in:
82
src/Command/JtlExportCommand.php
Normal file
82
src/Command/JtlExportCommand.php
Normal file
@@ -0,0 +1,82 @@
|
||||
<?php
|
||||
|
||||
namespace App\Command;
|
||||
|
||||
use App\Helper\HiltesImport;
|
||||
use App\Helper\Jtl;
|
||||
use App\Repository\ProductRepository;
|
||||
use App\Repository\StockRepository;
|
||||
use App\Repository\WarehouseRepository;
|
||||
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;
|
||||
|
||||
#[AsCommand(
|
||||
name: 'jtl:export',
|
||||
description: 'Create a export file for JTL Ameise',
|
||||
)]
|
||||
class JtlExportCommand extends Command
|
||||
{
|
||||
private $stockRepository;
|
||||
private $warehouseRepository;
|
||||
private $productRepository;
|
||||
private $logger;
|
||||
public function __construct(
|
||||
ProductRepository $productRepository,
|
||||
StockRepository $stockRepository,
|
||||
WarehouseRepository $warehouseRepository,
|
||||
LoggerInterface $logger
|
||||
)
|
||||
{
|
||||
$this->productRepository = $productRepository;
|
||||
$this->stockRepository = $stockRepository;
|
||||
$this->warehouseRepository = $warehouseRepository;
|
||||
$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);
|
||||
// $arg1 = $input->getArgument('arg1');
|
||||
//
|
||||
// if ($arg1) {
|
||||
// $io->note(sprintf('You passed an argument: %s', $arg1));
|
||||
// }
|
||||
//
|
||||
// if ($input->getOption('option1')) {
|
||||
// // ...
|
||||
// }
|
||||
|
||||
$io = new SymfonyStyle($input, $output);
|
||||
|
||||
$io->success('Start JTL Export');
|
||||
|
||||
/**
|
||||
* @var HiltesImport
|
||||
*/
|
||||
$jtl = new Jtl($this->productRepository,$this->warehouseRepository,$this->stockRepository,$this->logger);
|
||||
|
||||
$data = $jtl->getProducts();
|
||||
$jtl->createExportFile($data);
|
||||
|
||||
|
||||
|
||||
$io->success('Ende JTL Export');
|
||||
|
||||
return Command::SUCCESS;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user