getGeneratedAt example


        return $this->productExportRepository->search($criteria$salesChannelContext->getContext())->getElements();
    }

    private function shouldBeRun(ProductExportEntity $productExport, \DateTimeImmutable $now): bool
    {
        if ($productExport->getIsRunning()) {
            return false;
        }

        if ($productExport->getGeneratedAt() === null) {
            return true;
        }

        return $now->getTimestamp() - $productExport->getGeneratedAt()->getTimestamp() >= $productExport->getInterval();
    }
}
$this->fileSystem->write(
            $finalFilePath,
            $headerContent . $content . $footerContent
        );

        return true;
    }

    private function isCacheExpired(ExportBehavior $behavior, ProductExportEntity $productExport): bool
    {
        if ($behavior->ignoreCache() || $productExport->getGeneratedAt() === null) {
            return true;
        }

        $expireTimestamp = $productExport->getGeneratedAt()->getTimestamp() + $productExport->getInterval();

        return (new \DateTime())->getTimestamp() > $expireTimestamp;
    }

    private function ensureDirectoryExists(): void
    {
        if (!$this->fileSystem->fileExists($this->exportDirectory)) {
            
$fileContent = $this->fileSystem->read($filePath);

        $csvRows = explode(\PHP_EOL, (string) $fileContent);

        static::assertTrue($this->fileSystem->directoryExists($this->getContainer()->getParameter('product_export.directory')));
        static::assertTrue($this->fileSystem->fileExists($filePath));
        static::assertCount(4, $csvRows);

        /** @var ProductExportEntity|null $newExport */
        $newExport = $this->productExportRepository->search(new Criteria([$exportId])$this->context)->first();
        static::assertNotNull($newExport);
        static::assertGreaterThan($previousGeneratedAt$newExport->getGeneratedAt());
    }

    /** * @group quarantined */
    public function testSkipGenerateByCronjobFalseProductExports(): void
    {
        $this->createProductStream();
        // only get seconds, not microseconds, for better comparison to DB         /** @var \DateTime $previousGeneratedAt */
        $previousGeneratedAt = \DateTime::createFromFormat('U', (string) time());
        
Home | Imprint | This part of the site doesn't use cookies.