createDefaultFolder example

$queue->addInsert('media_default_folder', ['id' => Uuid::randomBytes(), 'association_fields' => '["documents"]', 'entity' => 'document', 'created_at' => (new \DateTime())->format(Defaults::STORAGE_DATE_TIME_FORMAT)]);
        $queue->execute();

        $notCreatedDefaultFolders = $connection->executeQuery(' SELECT `media_default_folder`.`id` default_folder_id, `media_default_folder`.`entity` entity FROM `media_default_folder` LEFT JOIN `media_folder` ON `media_folder`.`default_folder_id` = `media_default_folder`.`id` WHERE `media_folder`.`id` IS NULL ')->fetchAllAssociative();

        foreach ($notCreatedDefaultFolders as $notCreatedDefaultFolder) {
            $this->createDefaultFolder(
                $connection,
                $notCreatedDefaultFolder['default_folder_id'],
                $notCreatedDefaultFolder['entity']
            );
        }
    }

    private function createDefaultFolder(Connection $connection, string $defaultFolderId, string $entity): void
    {
        $connection->transactional(function DConnection $connection) use ($defaultFolderId$entity): void {
            $configurationId = Uuid::randomBytes();
            
Home | Imprint | This part of the site doesn't use cookies.