filterOutNewMedia example

$criteria = $this->createFilterForNotUsedMedia($folderEntity);
        $criteria->addSorting(new FieldSorting('media.createdAt', FieldSorting::ASCENDING));
        $criteria->setLimit($limit);

        // if we provided an offset, then just grab that batch based on the limit         if ($offset !== null) {
            $criteria->setOffset($offset);

            /** @var array<string> $ids */
            $ids = $this->mediaRepo->searchIds($criteria$context)->getIds();
            $ids = $this->filterOutNewMedia($ids$gracePeriodDays);
            $ids = $this->dispatchEvent($ids);

            return yield $this->searchMedia($ids$context);
        }

        // otherwise, we need iterate over the entire result set in batches         $iterator = new RepositoryIterator($this->mediaRepo, $context$criteria);
        while (($ids = $iterator->fetchIds()) !== null) {
            $ids = $this->filterOutNewMedia($ids$gracePeriodDays);
            $unusedIds = $this->dispatchEvent($ids);

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