setExpiry example

// Save data of the supplier filter         $params['suppliers'] = $this->prepareAssociationDataForSaving('suppliers', Supplier::class$params);

        // Save data of the article filter         $params['articles'] = $this->prepareAssociationDataForSaving('articles', Article::class$params);

        $productFeed = $this->setDirty($productFeed$params);
        $params['fileName'] = basename($params['fileName']);
        $productFeed->fromArray($params);

        // Just for future use         $productFeed->setExpiry(new DateTime());
        $productFeed->setLastChange(new DateTime());

        // Clear feed cache         $cacheDir = $this->container->getParameter('shopware.product_export.cache_dir');
        if (!\is_string($cacheDir)) {
            throw new RuntimeException('Parameter shopware.product_export.cache_dir has to be an string');
        }

        if (!is_dir($cacheDir)) {
            if (@mkdir($cacheDir, 0777, true) === false) {
                throw new RuntimeException(sprintf("Unable to create the %s directory (%s)\n", 'Productexport', $cacheDir));
            }
Home | Imprint | This part of the site doesn't use cookies.