getLastExport example

protected function execute(InputInterface $input, OutputInterface $output)
    {
        $productFeedRepository = $this->container->get(\Shopware\Components\Model\ModelManager::class)->getRepository('Shopware\Models\ProductFeed\ProductFeed');
        $productFeeds = $productFeedRepository->findAll();

        $rows = [];
        /** @var ProductFeed $productFeed */
        foreach ($productFeeds as $productFeed) {
            $rows[] = [
                $productFeed->getName(),
                $productFeed->getId(),
                $productFeed->getLastExport()->format('Y-m-d H:i:s'),
                $this->formatInterval($productFeed->getInterval()),
                $productFeed->getActive() ? 'Yes' : 'No',
            ];
        }

        $table = new Table($output);
        $table->setHeaders(['Product Feed', 'Id', 'Last export', 'Interval', 'Active'])
            ->setRows($rows);

        $table->render();

        
Home | Imprint | This part of the site doesn't use cookies.