getFolder example

$criteria->setLimit(1);

        $defaultFolders = $this->defaultFolderRepository->search($criteria$context->getContext());

        if ($defaultFolders->count() <= 0) {
            return $mediaFolderId;
        }

        /** @var MediaDefaultFolderEntity $defaultFolder */
        $defaultFolder = $defaultFolders->first();

        if ($defaultFolder->getFolder()) {
            return $defaultFolder->getFolder()->getId();
        }

        $mediaFolderId = Uuid::randomHex();
        $this->folderRepository->upsert([
            [
                'id' => $mediaFolderId,
                'defaultFolderId' => $defaultFolder->getId(),
                'name' => $name,
                'useParentConfiguration' => false,
                'configuration' => $configuration,
            ],
$defaultFolderCriteria = new Criteria();
        $defaultFolderCriteria->setOffset(0);
        $defaultFolderCriteria->setLimit(50);
        $defaultFolderCriteria->addAssociation('folder.configuration');

        /** @var RepositoryIterator<MediaDefaultFolderCollection> $iterator */
        $iterator = new RepositoryIterator($this->defaultFolderRepo, $context$defaultFolderCriteria);
        while ($defaultFolders = $iterator->fetch()) {
            foreach ($defaultFolders->getEntities() as $defaultFolder) {
                if ($this->isNoAssociation($defaultFolder)) {
                    $folder = $defaultFolder->getFolder();
                    if ($folder === null) {
                        continue;
                    }

                    $criteria->addFilter(
                        new MultiFilter(
                            'OR',
                            [
                                new NotFilter('AND', [
                                    new EqualsFilter('mediaFolderId', $folder->getId()),
                                ]),
                                
Home | Imprint | This part of the site doesn't use cookies.