orderRepository = $orderRepository; $this->logger = $logger; $this->sw = new Shopware($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')) { // // ... // } //offene Bestellungen aus Datenbank holen $this->orderData = $this->getOrders(); $this->getOrderDetails(); $io->success('Done!'); return Command::SUCCESS; } /** * @return array */ private function getOrders():array { return $this->orderRepository->findAll(); } /** * @return void */ public function getOrderDetails(): void { //Bestelldetails aus SW holen $this->getOrdersDataFromSW(); foreach ($this->orderData as $order) { $this->saveOrdersData($order); } } /** * holt alle fehlende Bestelldetails aus SW */ private function getOrdersDataFromSW(): void { foreach ($this->orderData as $value) { // Bei Shopware API anmelden $value->setData((array)$this->sw->getOrders($value)); } } /** * @param $orderData * @return void */ private function saveOrdersData($orderData): void { $orderData->setStatus = 1; $this->ordersRepository->add($orderData, true); } }