Adapter/PlentymarketsAdapter/ServiceBus/QueryHandler/Stock/FetchAllStocksQueryHandler.php
public function handle(QueryInterface $query)
    {
        $elements = $this->client->getIterator('items/variations', [
            'with' => 'stock',
        ]);

        $this->outputHandler->startProgressBar(count($elements));

        foreach ($elements as $element) {
            $stock = null;

            try {
                $stock = $this->responseParser->parse($element);
            } catch (Exception $exception) {
                $this->logger->error($exception->getMessage());
            }

            if ($stock !== null) {
                yield $stock;
            }

            $this->outputHandler->advanceProgressBar();
        }

        $this->outputHandler->finishProgressBar();
    }
public function handle(QueryInterface $query)
    {
        $elements = $this->client->getIterator('items/variations', [
            'with' => 'stock',
        ]);

        $this->outputHandler->startProgressBar(count($elements));

        foreach ($elements as $element) {
            $stock = null;

            try {
                $stock = $this->responseParser->parse($element);
            } catch (Exception $exception) {
                $this->logger->error($exception->getMessage());
            }

            if ($stock !== null) {
                yield $stock;
            }

            $this->outputHandler->advanceProgressBar();
        }

        $this->outputHandler->finishProgressBar();
    }
public function handle ( QueryInterface $ query ) { $ elements = $ this -> client -> getIterator ( 'items/variations' , [ 'with' => 'stock' , ] ) ; $ this -> outputHandler -> startProgressBar ( count ( $ elements ) ) ; foreach ( $ elements as $ element ) { $ stock = null ; try { $ stock = $ this -> responseParser -> parse ( $ element ) ; } catch ( Exception $ exception ) { $ this -> logger -> error ( $ exception -> getMessage ( ) ) ; } if ( $ stock !== null ) { yield $ stock ; } $ this -> outputHandler -> advanceProgressBar ( ) ; } $ this -> outputHandler -> finishProgressBar ( ) ; }
{@inheritdoc}
{