cloneEntity example

$versionId = $versionId ?? Uuid::randomHex();
        $versionData = ['id' => $versionId];

        if ($name) {
            $versionData['name'] = $name;
        }

        $context->scope(Context::SYSTEM_SCOPE, function D$context) use ($versionData): void {
            $this->entityWriter->upsert($this->versionDefinition, [$versionData]$context);
        });

        $affected = $this->cloneEntity($definition$id$id$versionId$contextnew CloneBehavior());

        $versionContext = $context->createWithVersionId($versionId);

        $event = EntityWrittenContainerEvent::createWithWrittenEvents($affected$versionContext->getContext()[]);
        $this->eventDispatcher->dispatch($event);

        $this->writeAuditLog($affected$context$versionId, true);

        return $versionId;
    }

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