filterPropertiesForClone example

$detail = $this->entityReader->read($definition$criteria$context->getContext())->first();

        if ($detail === null) {
            throw DataAbstractionLayerException::cannotCreateNewVersion($definition->getEntityName()$id);
        }

        $data = json_decode($this->serializer->serialize($detail, 'json'), true, 512, \JSON_THROW_ON_ERROR);

        $keepIds = $newId === $id;

        $data = $this->filterPropertiesForClone($definition$data$keepIds$id$definition$context->getContext());
        $data['id'] = $newId;

        $createdAtField = $definition->getField('createdAt');
        $updatedAtField = $definition->getField('updatedAt');

        if ($createdAtField instanceof DateTimeField) {
            $data['createdAt'] = new \DateTime();
        }

        if ($updatedAtField instanceof DateTimeField) {
            if ($updatedAtField->getFlag(Required::class)) {
                
Home | Imprint | This part of the site doesn't use cookies.