handleMediaDeletion example



        /** @var list<string> $affected */
        $affected = array_values($event->getIds(MediaFolderDefinition::ENTITY_NAME));
        if (!empty($affected)) {
            $this->handleFolderDeletion($affected$event->getContext());
        }

        /** @var list<string> $affected */
        $affected = array_values($event->getIds(MediaDefinition::ENTITY_NAME));
        if (!empty($affected)) {
            $this->handleMediaDeletion($affected$event->getContext());
        }
    }

    /** * @param list<string> $affected */
    private function handleMediaDeletion(array $affected, Context $context): void
    {
        $media = $context->scope(Context::SYSTEM_SCOPE, fn (Context $context): MediaCollection => $this->mediaRepository->search(new Criteria($affected)$context)->getEntities());

        $privatePaths = [];
        
Home | Imprint | This part of the site doesn't use cookies.