productRepository = $productRepository; $this->stockRepository = $stockRepository; $this->warehouseRepository = $warehouseRepository; $this->logger = $logger; parent::__construct(); } protected function configure(): void { $this->addOption('delta', 'd', InputOption::VALUE_NONE, 'Delta Import'); } protected function execute(InputInterface $input, OutputInterface $output): int { $io = new SymfonyStyle($input, $output); $io->success('Start JTL Export'); $rootPath = $this->GetProjectRootDir(); $delta = $input->getOption('delta'); /** * @var HiltesImport */ $jtl = new Jtl($this->productRepository, $this->warehouseRepository, $this->stockRepository, $this->logger, $rootPath); //Export für Standartlager $jtl->createExportFile($jtl->getProducts(['1', '3', '5', '10']), 'standard' . ($delta ? '_delta' : '')); //Export für WMS Lager $jtl->createExportFile($jtl->getProducts(['8']), 'wms' . ($delta ? '_delta' : '')); $io->success('Ende JTL Export'); return Command::SUCCESS; } public static function GetProjectRootDir() { $dirFullPath = __DIR__; //PRE: $dirs = /app/public/src/Helpers $dirs = explode('/', $dirFullPath); array_pop($dirs); //remove last element in array ('Helpers') array_pop($dirs); //remove the next last element from array ('src') //POST: $dirs = /app/public return implode('/', $dirs); } }